changeset 16582:cbd0ee58633b

texture units do not need to be explicitly enabled when using a fragment program.
author reimar
date Sun, 25 Sep 2005 13:56:42 +0000
parents 579385796bc3
children 84356c6d997b
files libvo/gl_common.c
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/gl_common.c	Sun Sep 25 13:45:26 2005 +0000
+++ b/libvo/gl_common.c	Sun Sep 25 13:56:42 2005 +0000
@@ -644,23 +644,21 @@
  */
 void inline glEnableYUVConversion(GLenum target, int type) {
   if (type <= 0) return;
-  ActiveTexture(GL_TEXTURE1);
-  glEnable(target);
-  ActiveTexture(GL_TEXTURE2);
-  glEnable(target);
   switch (type) {
     case YUV_CONVERSION_COMBINERS:
+      ActiveTexture(GL_TEXTURE1);
+      glEnable(target);
+      ActiveTexture(GL_TEXTURE2);
+      glEnable(target);
+      ActiveTexture(GL_TEXTURE0);
       glEnable(GL_REGISTER_COMBINERS_NV);
       break;
     case YUV_CONVERSION_FRAGMENT_LOOKUP:
-      ActiveTexture(GL_TEXTURE3);
-      glEnable(GL_TEXTURE_2D);
     case YUV_CONVERSION_FRAGMENT_POW:
     case YUV_CONVERSION_FRAGMENT:
       glEnable(GL_FRAGMENT_PROGRAM);
       break;
   }
-  ActiveTexture(GL_TEXTURE0);
 }
 
 /**
@@ -670,23 +668,21 @@
  */
 void inline glDisableYUVConversion(GLenum target, int type) {
   if (type <= 0) return;
-  ActiveTexture(GL_TEXTURE1);
-  glDisable(target);
-  ActiveTexture(GL_TEXTURE2);
-  glDisable(target);
   switch (type) {
     case YUV_CONVERSION_COMBINERS:
+      ActiveTexture(GL_TEXTURE1);
+      glDisable(target);
+      ActiveTexture(GL_TEXTURE2);
+      glDisable(target);
+      ActiveTexture(GL_TEXTURE0);
       glDisable(GL_REGISTER_COMBINERS_NV);
       break;
     case YUV_CONVERSION_FRAGMENT_LOOKUP:
-      ActiveTexture(GL_TEXTURE3);
-      glDisable(GL_TEXTURE_2D);
     case YUV_CONVERSION_FRAGMENT_POW:
     case YUV_CONVERSION_FRAGMENT:
       glDisable(GL_FRAGMENT_PROGRAM);
       break;
   }
-  ActiveTexture(GL_TEXTURE0);
 }
 
 /**