summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2000-10-21 01:22:13 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2000-10-21 01:22:13 +0000
commitfceecc5bc1e1d12a672a8357f91eb27ef0ac0d60 (patch)
tree840c9514ad728975e1f1ac2d98457fdccbfe4237
parentcb5d29cd170fec0a49e1fd5126520f8424e30288 (diff)
fixed a texture enable bug
-rw-r--r--src/mesa/main/enable.c30
-rw-r--r--src/mesa/main/state.c9
2 files changed, 11 insertions, 28 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index 46edd625a95..f1bccb61d8a 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,10 +1,10 @@
-/* $Id: enable.c,v 1.21.4.1 2000/10/05 23:10:35 brianp Exp $ */
+/* $Id: enable.c,v 1.21.4.2 2000/10/21 01:22:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
- * Copyright (C) 1999 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -352,48 +352,39 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
case GL_TEXTURE_1D:
if (ctx->Visual->RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit;
- const GLuint flag = TEXTURE0_1D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
ctx->NewState |= NEW_TEXTURE_ENABLE;
if (state) {
texUnit->Enabled |= TEXTURE0_1D;
- ctx->Enabled |= flag;
}
else {
texUnit->Enabled &= ~TEXTURE0_1D;
- ctx->Enabled &= ~flag;
}
}
break;
case GL_TEXTURE_2D:
if (ctx->Visual->RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit;
- const GLuint flag = TEXTURE0_2D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
ctx->NewState |= NEW_TEXTURE_ENABLE;
if (state) {
texUnit->Enabled |= TEXTURE0_2D;
- ctx->Enabled |= flag;
}
else {
texUnit->Enabled &= ~TEXTURE0_2D;
- ctx->Enabled &= ~flag;
}
}
break;
case GL_TEXTURE_3D:
if (ctx->Visual->RGBAflag) {
const GLuint curr = ctx->Texture.CurrentUnit;
- const GLuint flag = TEXTURE0_3D << (curr * 4);
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr];
ctx->NewState |= NEW_TEXTURE_ENABLE;
if (state) {
texUnit->Enabled |= TEXTURE0_3D;
- ctx->Enabled |= flag;
}
else {
texUnit->Enabled &= ~TEXTURE0_3D;
- ctx->Enabled &= ~flag;
}
}
break;
@@ -513,35 +504,24 @@ void _mesa_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
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");
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
}
break;
default:
- if (state) {
- gl_error( ctx, GL_INVALID_ENUM, "glEnable" );
- }
- else {
- gl_error( ctx, GL_INVALID_ENUM, "glDisable" );
- }
+ gl_error(ctx, GL_INVALID_ENUM, state ? "glEnable" : "glDisable");
return;
}
diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c
index 34412118299..1ac24cd4016 100644
--- a/src/mesa/main/state.c
+++ b/src/mesa/main/state.c
@@ -1,7 +1,8 @@
+/* $Id: state.c,v 1.21.4.3 2000/10/21 01:22:13 brianp Exp $ */
/*
* Mesa 3-D graphics library
- * Version: 3.3
+ * Version: 3.4
*
* Copyright (C) 1999-2000 Brian Paul All Rights Reserved.
*
@@ -974,9 +975,11 @@ void gl_update_state( GLcontext *ctx )
}
}
}
+ else {
+ ctx->Texture.Unit[i].ReallyEnabled = 0;
+ }
}
-
- ctx->Texture.ReallyEnabled = ctx->Enabled & ENABLE_TEX_ANY;
+ ctx->Enabled = (ctx->Enabled & ~ENABLE_TEX_ANY) | ctx->Texture.ReallyEnabled;
ctx->NeedNormals = (ctx->Light.Enabled || ctx->Texture.NeedNormals);
}