diff options
Diffstat (limited to 'src/mbgl/util/raster.cpp')
-rw-r--r-- | src/mbgl/util/raster.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mbgl/util/raster.cpp b/src/mbgl/util/raster.cpp index 704d05e1eb..a74b73a016 100644 --- a/src/mbgl/util/raster.cpp +++ b/src/mbgl/util/raster.cpp @@ -1,5 +1,5 @@ #include <mbgl/platform/platform.hpp> -#include <mbgl/platform/gl.hpp> +#include <mbgl/gl/gl.hpp> #include <mbgl/platform/log.hpp> #include <mbgl/util/raster.hpp> @@ -9,13 +9,14 @@ using namespace mbgl; -Raster::Raster(TexturePool& texturePool_) +Raster::Raster(gl::TexturePool& texturePool_) : texturePool(texturePool_) {} Raster::~Raster() { if (textured) { - texturePool.removeTextureID(texture); + texturePool.releaseTextureID(textureID); + textureID = 0; } } @@ -36,16 +37,16 @@ void Raster::load(PremultipliedImage image) { } -void Raster::bind(bool linear) { +void Raster::bind(bool linear, gl::GLObjectStore& glObjectStore) { if (!width || !height) { Log::Error(Event::OpenGL, "trying to bind texture without dimension"); return; } if (img.data && !textured) { - upload(); + upload(glObjectStore); } else if (textured) { - MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); + MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, textureID)); } GLint new_filter = linear ? GL_LINEAR : GL_NEAREST; @@ -56,10 +57,10 @@ void Raster::bind(bool linear) { } } -void Raster::upload() { +void Raster::upload(gl::GLObjectStore& glObjectStore) { if (img.data && !textured) { - texture = texturePool.getTextureID(); - MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, texture)); + textureID = texturePool.getTextureID(glObjectStore); + MBGL_CHECK_ERROR(glBindTexture(GL_TEXTURE_2D, textureID)); #ifndef GL_ES_VERSION_2_0 MBGL_CHECK_ERROR(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0)); #endif |