aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/enable.c4
-rw-r--r--src/mesa/main/light.c59
2 files changed, 60 insertions, 3 deletions
diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
index aa662900777..c12013a421a 100644
--- a/src/mesa/main/enable.c
+++ b/src/mesa/main/enable.c
@@ -1,4 +1,4 @@
-/* $Id: enable.c,v 1.8 1999/11/08 07:36:44 brianp Exp $ */
+/* $Id: enable.c,v 1.9 1999/11/10 06:29:44 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -123,6 +123,8 @@ void gl_set_enable( GLcontext *ctx, GLenum cap, GLboolean state )
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:
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 9712866032f..e38e25ba822 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1,4 +1,4 @@
-/* $Id: light.c,v 1.7 1999/11/08 07:36:44 brianp Exp $ */
+/* $Id: light.c,v 1.8 1999/11/10 06:29:44 keithw Exp $ */
/*
* Mesa 3-D graphics library
@@ -435,6 +435,9 @@ void gl_update_material( GLcontext *ctx,
if (ctx->Light.ColorMaterialEnabled)
bitmask &= ~ctx->Light.ColorMaterialBitmask;
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "gl_update_material, mask %x\n", bitmask);
+
if (!bitmask)
return;
@@ -531,6 +534,26 @@ void gl_update_material( GLcontext *ctx,
ctx->Light.Material[1].SpecularIndex = src[1].SpecularIndex;
}
+ if (0)
+ {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ fprintf(stderr, "update_mat emission : %f %f %f\n",
+ mat->Emission[0],
+ mat->Emission[1],
+ mat->Emission[2]);
+ fprintf(stderr, "update_mat specular : %f %f %f\n",
+ mat->Specular[0],
+ mat->Specular[1],
+ mat->Specular[2]);
+ fprintf(stderr, "update_mat diffuse : %f %f %f\n",
+ mat->Diffuse[0],
+ mat->Diffuse[1],
+ mat->Diffuse[2]);
+ fprintf(stderr, "update_mat ambient : %f %f %f\n",
+ mat->Ambient[0],
+ mat->Ambient[1],
+ mat->Ambient[2]);
+ }
}
@@ -546,6 +569,10 @@ void gl_update_color_material( GLcontext *ctx,
GLfloat tmp[4], color[4];
UBYTE_RGBA_TO_FLOAT_RGBA( color, rgba );
+
+ if (MESA_VERBOSE&VERBOSE_IMMEDIATE)
+ fprintf(stderr, "gl_update_color_material, mask %x\n", bitmask);
+
if (bitmask & FRONT_AMBIENT_BIT) {
struct gl_material *mat = &ctx->Light.Material[0];
@@ -623,6 +650,27 @@ void gl_update_color_material( GLcontext *ctx,
ACC_3V( ctx->Light.BaseColor[1], tmp );
COPY_4FV( mat->Emission, color );
}
+
+ if (0)
+ {
+ struct gl_material *mat = &ctx->Light.Material[0];
+ fprintf(stderr, "update_color_mat emission : %f %f %f\n",
+ mat->Emission[0],
+ mat->Emission[1],
+ mat->Emission[2]);
+ fprintf(stderr, "update_color_mat specular : %f %f %f\n",
+ mat->Specular[0],
+ mat->Specular[1],
+ mat->Specular[2]);
+ fprintf(stderr, "update_color_mat diffuse : %f %f %f\n",
+ mat->Diffuse[0],
+ mat->Diffuse[1],
+ mat->Diffuse[2]);
+ fprintf(stderr, "update_color_mat ambient : %f %f %f\n",
+ mat->Ambient[0],
+ mat->Ambient[1],
+ mat->Ambient[2]);
+ }
}
@@ -638,6 +686,11 @@ void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx, "glColorMaterial");
+ if (MESA_VERBOSE&VERBOSE_API)
+ fprintf(stderr, "glColorMaterial %s %s\n",
+ gl_lookup_enum_by_nr(face),
+ gl_lookup_enum_by_nr(mode));
+
bitmask = gl_material_bitmask( ctx, face, mode, legal, "glColorMaterial" );
if (bitmask != 0) {
@@ -645,6 +698,9 @@ void gl_ColorMaterial( GLcontext *ctx, GLenum face, GLenum mode )
ctx->Light.ColorMaterialFace = face;
ctx->Light.ColorMaterialMode = mode;
}
+
+ if (ctx->Light.ColorMaterialEnabled)
+ gl_update_color_material( ctx, ctx->Current.ByteColor );
}
@@ -680,7 +736,6 @@ void gl_Materialfv( GLcontext *ctx,
IM->MaterialMask[count] = 0;
}
-
IM->MaterialMask[count] |= bitmask;
mat = IM->Material[count];