fix GL_BACK color material bug
[mesa.git] / src / mesa / main / enable.c
index e49528e0ae3323b0c06399302ad81bbdba3d8341..0fa408f7644acf8f7c2f05bed008ff2d0de3b026 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.19 2000/05/07 20:41:30 brianp Exp $ */
+/* $Id: enable.c,v 1.21 2000/05/23 15:17:12 brianp Exp $ */
 
 /*
  * Mesa 3-D graphics library
@@ -506,6 +506,33 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
          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" );
@@ -738,6 +765,17 @@ _mesa_IsEnabled( GLenum cap )
       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;