diff options
author | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-14 22:26:30 +0200 |
---|---|---|
committer | Bruno de Oliveira Abinader <bruno@mapbox.com> | 2016-02-18 13:27:35 +0200 |
commit | 124173080f35d4a53e24790c0ad2cf2687d35836 (patch) | |
tree | 415f17836fd92d53fa212b55c29536d71407df1c /src/mbgl/sprite/sprite_atlas.cpp | |
parent | 3397398c1f5f05e22219557e0e81cfe61d693b33 (diff) | |
download | qtlocation-mapboxgl-124173080f35d4a53e24790c0ad2cf2687d35836.tar.gz |
[gl] Added mbgl::gl::Texture{,Pool}Holder
Diffstat (limited to 'src/mbgl/sprite/sprite_atlas.cpp')
-rw-r--r-- | src/mbgl/sprite/sprite_atlas.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/mbgl/sprite/sprite_atlas.cpp b/src/mbgl/sprite/sprite_atlas.cpp index 269ceb2c7c..7137e6d1fc 100644 --- a/src/mbgl/sprite/sprite_atlas.cpp +++ b/src/mbgl/sprite/sprite_atlas.cpp @@ -3,7 +3,6 @@ #include <mbgl/gl/gl.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/platform/platform.hpp> -#include <mbgl/gl/gl_object_store.hpp> #include <mbgl/util/math.hpp> #include <mbgl/util/std.hpp> #include <mbgl/util/constants.hpp> @@ -187,8 +186,8 @@ void SpriteAtlas::bind(bool linear) { } if (!texture) { - MBGL_CHECK_ERROR(glGenTextures(1, &texture)); - MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); + texture.create(); + MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture.getID())); #ifndef GL_ES_VERSION_2_0 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); #endif @@ -198,7 +197,7 @@ void SpriteAtlas::bind(bool linear) { MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); fullUploadRequired = true; } else { - MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); + MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture.getID())); } GLuint filter_val = linear ? GL_LINEAR : GL_NEAREST; @@ -250,8 +249,7 @@ void SpriteAtlas::bind(bool linear) { SpriteAtlas::~SpriteAtlas() { std::lock_guard<std::recursive_mutex> lock(mtx); if (texture) { - mbgl::util::ThreadContext::getGLObjectStore()->abandonTexture(texture); - texture = 0; + mbgl::util::ThreadContext::getGLObjectStore()->abandon(std::move(texture)); } } |