fix GL_BACK color material bug
[mesa.git] / src / mesa / main / enable.c
index b5e659afd10ed5451c7a8ce1d45306a6ed6c083e..0fa408f7644acf8f7c2f05bed008ff2d0de3b026 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.16 2000/05/04 13:48:49 brianp Exp $ */
+/* $Id: enable.c,v 1.21 2000/05/23 15:17:12 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -195,6 +195,7 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
       case GL_LINE_SMOOTH:
         if (ctx->Line.SmoothFlag!=state) {
             ctx->Line.SmoothFlag = state;
+           ctx->TriangleCaps ^= DD_LINE_SMOOTH;
             ctx->NewState |= NEW_RASTER_OPS;
          }
         break;
@@ -494,6 +495,44 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
          ctx->Pixel.PostColorMatrixColorTableEnabled = state;
          break;
 
+      /* GL_EXT_convolution */
+      case GL_CONVOLUTION_1D:
+         ctx->Pixel.Convolution1DEnabled = state;
+         break;
+      case GL_CONVOLUTION_2D:
+         ctx->Pixel.Convolution2DEnabled = state;
+         break;
+      case GL_SEPARABLE_2D:
+         ctx->Pixel.Separable2DEnabled = state;
+         break;
+
+      /* GL_ARB_texture_cube_map */
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         if (ctx->Extensions.HaveTextureCubeMap) {
+            if (ctx->Visual->RGBAflag) {
+               const GLuint curr = ctx->Texture.CurrentUnit;
+               const GLuint flag = TEXTURE0_CUBE << (curr * 4);
+               struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
+               ctx->NewState |= NEW_TEXTURE_ENABLE;
+               if (state) {
+                  texUnit->Enabled |= TEXTURE0_CUBE;
+                  ctx->Enabled |= flag;
+               }
+               else {
+                  texUnit->Enabled &= ~TEXTURE0_CUBE;
+                  ctx->Enabled &= ~flag;
+               }
+            }
+         }
+         else {
+            if (state)
+               gl_error(ctx, GL_INVALID_ENUM, "glEnable");
+            else
+               gl_error(ctx, GL_INVALID_ENUM, "glDisable");
+            return;
+         }
+        break;
+
       default:
         if (state) {
            gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
@@ -718,6 +757,25 @@ _mesa_IsEnabled( GLenum cap )
       case GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI:
          return ctx->Pixel.PostColorMatrixColorTableEnabled;
 
+      /* GL_EXT_convolution */
+      case GL_CONVOLUTION_1D:
+         return ctx->Pixel.Convolution1DEnabled;
+      case GL_CONVOLUTION_2D:
+         return ctx->Pixel.Convolution2DEnabled;
+      case GL_SEPARABLE_2D:
+         return ctx->Pixel.Separable2DEnabled;
+
+      /* GL_ARB_texture_cube_map */
+      case GL_TEXTURE_CUBE_MAP_ARB:
+         if (ctx->Extensions.HaveTextureCubeMap) {
+            const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit];
+            return (texUnit->Enabled & TEXTURE0_CUBE) ? GL_TRUE : GL_FALSE;
+         }
+         else {
+            gl_error(ctx, GL_INVALID_ENUM, "glIsEnabled");
+            return GL_FALSE;
+         }
+
       default:
         gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
         return GL_FALSE;