瀏覽代碼

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

Lasse Öörni 11 年之前
父節點
當前提交
73bbf3f787
共有 1 個文件被更改,包括 5 次插入1 次删除
  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 (glType != textureTypes_[index])
             {
             {
                 if (textureTypes_[index])
                 if (textureTypes_[index])
+                {
+                    if (textures_[index])
+                        glBindTexture(textureTypes_[index], 0);
                     glDisable(textureTypes_[index]);
                     glDisable(textureTypes_[index]);
-                
+                }
+
                 glEnable(glType);
                 glEnable(glType);
                 textureTypes_[index] = glType;
                 textureTypes_[index] = glType;
             }
             }