Only bind images when they weren't (issue #353)

This commit is contained in:
Bart van Strien
2012-01-07 11:37:50 +01:00
parent c78c6801e9
commit 870973197c
+8 -1
View File
@@ -262,7 +262,14 @@ namespace opengl
void Image::bind() const void Image::bind() const
{ {
if (texture != 0) if (texture == 0)
return;
GLuint boundTex;
glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint *)&boundTex);
// only bind if this texture is not already bound
if (boundTex != texture)
glBindTexture(GL_TEXTURE_2D, texture); glBindTexture(GL_TEXTURE_2D, texture);
} }