From 124173080f35d4a53e24790c0ad2cf2687d35836 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Sun, 14 Feb 2016 22:26:30 +0200 Subject: [gl] Added mbgl::gl::Texture{,Pool}Holder --- src/mbgl/sprite/sprite_atlas.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/mbgl/sprite/sprite_atlas.cpp') 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 #include #include -#include #include #include #include @@ -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 lock(mtx); if (texture) { - mbgl::util::ThreadContext::getGLObjectStore()->abandonTexture(texture); - texture = 0; + mbgl::util::ThreadContext::getGLObjectStore()->abandon(std::move(texture)); } } -- cgit v1.2.1