gl: make sure we detach textures and disable texturing on all gl stages
authorJoakim Plate <elupus@ecce.se>
Wed, 8 Jan 2014 19:46:54 +0000 (20:46 +0100)
committerJoakim Plate <elupus@ecce.se>
Sat, 11 Jan 2014 22:36:44 +0000 (23:36 +0100)
When limited range colors was in use, we could end up adjusting range
twice since the last texture stage could be left around modifying
following render.

xbmc/guilib/GUIFontTTFGL.cpp
xbmc/guilib/GUITextureGL.cpp

index 1e69cda..3358a5a 100644 (file)
@@ -146,8 +146,12 @@ void CGUIFontTTFGL::End()
   glDrawArrays(GL_QUADS, 0, m_vertex_count);
   glPopClientAttrib();
 
+  glActiveTexture(GL_TEXTURE1);
   glBindTexture(GL_TEXTURE_2D, 0);
+  glDisable(GL_TEXTURE_2D);
   glActiveTexture(GL_TEXTURE0);
+  glBindTexture(GL_TEXTURE_2D, 0);
+  glDisable(GL_TEXTURE_2D);
 #else
   // GLES 2.0 version. Cannot draw quads. Convert to triangles.
   GLint posLoc  = g_Windowing.GUIShaderGetPos();
index 7e54c74..44e19a3 100644 (file)
@@ -118,9 +118,14 @@ void CGUITextureGL::Begin(color_t color)
 void CGUITextureGL::End()
 {
   glEnd();
-  if (m_diffuse.size())
-    glDisable(GL_TEXTURE_2D);
+  glActiveTexture(GL_TEXTURE2_ARB);
+  glBindTexture(GL_TEXTURE_2D, 0);
+  glDisable(GL_TEXTURE_2D);
+  glActiveTexture(GL_TEXTURE1_ARB);
+  glBindTexture(GL_TEXTURE_2D, 0);
+  glDisable(GL_TEXTURE_2D);
   glActiveTexture(GL_TEXTURE0_ARB);
+  glBindTexture(GL_TEXTURE_2D, 0);
   glDisable(GL_TEXTURE_2D);
 }