-/* $Id: enable.c,v 1.4 1999/09/07 22:31:30 brianp Exp $ */
+/* $Id: enable.c,v 1.12 2000/03/11 23:23:26 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.1
+ * Version: 3.3
*
* Copyright (C) 1999 Brian Paul All Rights Reserved.
*
#ifdef PC_HEADER
#include "all.h"
#else
-#include <string.h>
-#include <stdio.h>
+#include "glheader.h"
#include "context.h"
#include "enable.h"
#include "light.h"
#include "vbfill.h"
#include "xform.h"
#include "enums.h"
-#ifdef XFree86Server
-#include "GL/xf86glx.h"
-#endif
#endif
/*
* Perform glEnable and glDisable calls.
*/
-void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
+void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
{
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx, "gl_enable/disable" );
if (ctx->Light.ColorMaterialEnabled!=state) {
ctx->Light.ColorMaterialEnabled = state;
ctx->NewState |= NEW_LIGHTING;
+ if (state)
+ gl_update_color_material( ctx, ctx->Current.ByteColor );
}
break;
case GL_CULL_FACE:
if (ctx->Light.Enabled!=state) {
ctx->Light.Enabled = state;
ctx->Enabled &= ~ENABLE_LIGHT;
- if (state && !is_empty_list(&ctx->Light.EnabledList))
+ if (state)
ctx->Enabled |= ENABLE_LIGHT;
ctx->NewState |= NEW_LIGHTING;
}
break;
case GL_SHARED_TEXTURE_PALETTE_EXT:
ctx->Texture.SharedPalette = state;
- if (ctx->Driver.UseGlobalTexturePalette)
- (*ctx->Driver.UseGlobalTexturePalette)( ctx, state );
break;
case GL_STENCIL_TEST:
if (state && ctx->Visual->StencilBits==0) {
if (ctx->Stencil.Enabled!=state) {
ctx->Stencil.Enabled = state;
ctx->NewState |= NEW_RASTER_OPS;
+ ctx->TriangleCaps ^= DD_STENCIL;
}
break;
case GL_TEXTURE_1D:
ctx->Array.EdgeFlag.Enabled = state;
break;
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ ctx->Depth.OcclusionTest = state;
+ ctx->NewState |= NEW_RASTER_OPS;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, state ? "glEnable": "glDisable" );
+ return;
+ }
+ break;
+
default:
if (state) {
gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
-void gl_Enable( GLcontext* ctx, GLenum cap )
+void
+_mesa_Enable( GLenum cap )
{
- gl_set_enable( ctx, cap, GL_TRUE );
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_set_enable( ctx, cap, GL_TRUE );
}
-void gl_Disable( GLcontext* ctx, GLenum cap )
+void
+_mesa_Disable( GLenum cap )
{
- gl_set_enable( ctx, cap, GL_FALSE );
+ GET_CURRENT_CONTEXT(ctx);
+ _mesa_set_enable( ctx, cap, GL_FALSE );
}
-GLboolean gl_IsEnabled( GLcontext* ctx, GLenum cap )
+GLboolean
+_mesa_IsEnabled( GLenum cap )
{
+ GET_CURRENT_CONTEXT(ctx);
switch (cap) {
case GL_ALPHA_TEST:
return ctx->Color.AlphaEnabled;
return ctx->Array.TexCoord[ctx->Array.ActiveTexture].Enabled;
case GL_EDGE_FLAG_ARRAY:
return ctx->Array.EdgeFlag.Enabled;
+
+ /* GL_HP_occlusion_test */
+ case GL_OCCLUSION_TEST_HP:
+ if (ctx->Extensions.HaveHpOcclusionTest) {
+ return ctx->Depth.OcclusionTest;
+ }
+ else {
+ gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
+ return GL_FALSE;
+ }
+
default:
gl_error( ctx, GL_INVALID_ENUM, "glIsEnabled" );
return GL_FALSE;
-static void gl_client_state( GLcontext *ctx, GLenum cap, GLboolean state )
+static void
+client_state( GLcontext *ctx, GLenum cap, GLboolean state )
{
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH( ctx,
(state
-void gl_EnableClientState( GLcontext *ctx, GLenum cap )
+void
+_mesa_EnableClientState( GLenum cap )
{
- gl_client_state( ctx, cap, GL_TRUE );
+ GET_CURRENT_CONTEXT(ctx);
+ client_state( ctx, cap, GL_TRUE );
}
-void gl_DisableClientState( GLcontext *ctx, GLenum cap )
+void
+_mesa_DisableClientState( GLenum cap )
{
- gl_client_state( ctx, cap, GL_FALSE );
+ GET_CURRENT_CONTEXT(ctx);
+ client_state( ctx, cap, GL_FALSE );
}