Browse Source

Fix textures left bound in multiple units if the texture type (2D, cubemap) differs on OpenGL.

Lasse Öörni 11 years ago
parent
commit
73bbf3f787
1 changed files with 5 additions and 1 deletions
  1. 5 1
      Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

+ 5 - 1
Source/Urho3D/Graphics/OpenGL/OGLGraphics.cpp

@@ -1474,8 +1474,12 @@ void Graphics::SetTexture(unsigned index, Texture* texture)
             if (glType != textureTypes_[index])
             {
                 if (textureTypes_[index])
+                {
+                    if (textures_[index])
+                        glBindTexture(textureTypes_[index], 0);
                     glDisable(textureTypes_[index]);
-                
+                }
+
                 glEnable(glType);
                 textureTypes_[index] = glType;
             }