X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fopengl%2Ftexture_backend.cpp;h=818defdd44c475a103b96adcf2ac20d8acb7f12e;hb=HEAD;hp=ebfeb0255b2083d8a04b8b49ff0503302e361333;hpb=e70662d7812464159f2e47f4bebb69d88f89ae93;p=libs%2Fgl.git diff --git a/source/backends/opengl/texture_backend.cpp b/source/backends/opengl/texture_backend.cpp index ebfeb025..818defdd 100644 --- a/source/backends/opengl/texture_backend.cpp +++ b/source/backends/opengl/texture_backend.cpp @@ -2,6 +2,7 @@ #include #include #include +#include "device.h" #include "gl.h" #include "error.h" #include "texture.h" @@ -12,8 +13,6 @@ using namespace std; namespace Msp { namespace GL { -OpenGLTexture *OpenGLTexture::scratch_binding = 0; - OpenGLTexture::OpenGLTexture(unsigned t): target(t) { @@ -35,7 +34,7 @@ OpenGLTexture::OpenGLTexture(OpenGLTexture &&other): OpenGLTexture::~OpenGLTexture() { - if(this==scratch_binding) + if(this==Device::get_current().get_state().scratch_texture) unbind_scratch(); if(id) glDeleteTextures(1, &id); @@ -119,6 +118,7 @@ void OpenGLTexture::set_debug_name(const string &name) void OpenGLTexture::bind_scratch() { + const OpenGLTexture *&scratch_binding = Device::get_current().get_state().scratch_texture; if(!scratch_binding) glActiveTexture(GL_TEXTURE0); if(scratch_binding!=this) @@ -132,6 +132,7 @@ void OpenGLTexture::bind_scratch() void OpenGLTexture::unbind_scratch() { + const OpenGLTexture *&scratch_binding = Device::get_current().get_state().scratch_texture; if(scratch_binding) { glBindTexture(scratch_binding->target, 0);