From bf4e9d086293d6a398955af7453101a0abdf8ba4 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 16 Jan 2015 14:39:47 -0500 Subject: [PATCH] remove duplicate lineatlas texture update --- src/mbgl/geometry/line_atlas.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp index 5cfb67021..fa5535a8c 100644 --- a/src/mbgl/geometry/line_atlas.cpp +++ b/src/mbgl/geometry/line_atlas.cpp @@ -111,6 +111,8 @@ LinePatternPos LineAtlas::addDash(const std::vector &dasharray, bool roun }; void LineAtlas::bind() { + std::lock_guard lock(mtx); + bool first = false; if (!texture) { MBGL_CHECK_ERROR(glGenTextures(1, &texture)); @@ -119,13 +121,12 @@ void LineAtlas::bind() { MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)); MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)); MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); - dirty = true; + first = true; } else { MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); } if (dirty) { - std::lock_guard lock(mtx); if (first) { glTexImage2D( GL_TEXTURE_2D, // GLenum target @@ -153,9 +154,6 @@ void LineAtlas::bind() { } - // TODO use texsubimage for updates - // TODO lock? - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, width, height, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data); dirty = false; } };