Add support for GL_REPLACE_EXT texture env mode.
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 30 Apr 2008 22:05:01 +0000 (16:05 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 30 Apr 2008 22:07:33 +0000 (16:07 -0600)
GL_REPLACE_EXT comes from the ancient GL_EXT_texture extension.  Found an old demo that
actually uses it.
The values of the GL_REPLACE and GL_REPLACE_EXT tokens is different, unfortunately.

src/mesa/main/texstate.c

index 288b334..626c264 100644 (file)
@@ -213,6 +213,9 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
       return;
    }
 
+   if (mode == GL_REPLACE_EXT)
+      mode = GL_REPLACE;
+
    switch (mode) {
    case GL_REPLACE:
    case GL_MODULATE:
@@ -315,7 +318,9 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param )
       switch (pname) {
       case GL_TEXTURE_ENV_MODE:
          {
-            const GLenum mode = (GLenum) (GLint) *param;
+            GLenum mode = (GLenum) (GLint) *param;
+            if (mode == GL_REPLACE_EXT)
+               mode = GL_REPLACE;
            if (texUnit->EnvMode == mode)
               return;
             if (mode == GL_MODULATE ||