fixed vertex color problems
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 2 May 2001 23:08:35 +0000 (23:08 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 2 May 2001 23:08:35 +0000 (23:08 +0000)
src/mesa/drivers/glide/fxtris.c
src/mesa/drivers/glide/fxvbtmp.h

index 5adb11e1f3f5c6f665fc8389a78e2e172b417ceb..829aabe74926ca9c68c5e32fd12e71ea27b6a28b 100644 (file)
@@ -115,11 +115,11 @@ fx_draw_tri(GLcontext * ctx, const fxVertex * v0, const fxVertex * v1,
 
 
 #define FX_COLOR(vert, c) {                            \
-  GLubyte *col = c;                                    \
-  vert->v.r = col[0] * 255;    \
-  vert->v.g = col[1] * 255;    \
-  vert->v.b = col[2] * 255;    \
-  vert->v.a = col[3] * 255;    \
+  GLfloat *col = c;                                    \
+  UNCLAMPED_FLOAT_TO_UBYTE(vert->v.r, col[0]);         \
+  UNCLAMPED_FLOAT_TO_UBYTE(vert->v.g, col[1]);         \
+  UNCLAMPED_FLOAT_TO_UBYTE(vert->v.b, col[2]);         \
+  UNCLAMPED_FLOAT_TO_UBYTE(vert->v.a, col[3]);         \
 }
 
 #define FX_COPY_COLOR( dst, src ) {            \
index 39c69adf2d9f794b885689469d434da73a548aa4..24d5b521a0075df7c158e01031a1b20e2687e639 100644 (file)
@@ -80,10 +80,10 @@ NAME(GLcontext * ctx, GLuint start, GLuint end)
               }
            }
            if (IND & SETUP_RGBA) {
-              v->v.r = color[i][0] * 255.0;
-              v->v.g = color[i][1] * 255.0;
-              v->v.b = color[i][2] * 255.0;
-              v->v.a = color[i][3] * 255.0;
+               UNCLAMPED_FLOAT_TO_UBYTE(v->v.r, color[i][0]);
+               UNCLAMPED_FLOAT_TO_UBYTE(v->v.g, color[i][1]);
+               UNCLAMPED_FLOAT_TO_UBYTE(v->v.b, color[i][2]);
+               UNCLAMPED_FLOAT_TO_UBYTE(v->v.a, color[i][3]);
            }
            if (IND & SETUP_TMU0) {
               v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow;
@@ -118,10 +118,10 @@ NAME(GLcontext * ctx, GLuint start, GLuint end)
            }
         }
         if (IND & SETUP_RGBA) {
-           v->v.r = color[i][0] * 255.0;
-           v->v.g = color[i][1] * 255.0;
-           v->v.b = color[i][2] * 255.0;
-           v->v.a = color[i][3] * 255.0;
+            UNCLAMPED_FLOAT_TO_UBYTE(v->v.r, color[i][0]);
+            UNCLAMPED_FLOAT_TO_UBYTE(v->v.g, color[i][1]);
+            UNCLAMPED_FLOAT_TO_UBYTE(v->v.b, color[i][2]);
+            UNCLAMPED_FLOAT_TO_UBYTE(v->v.a, color[i][3]);
         }
         if (IND & SETUP_TMU0) {
            v->v.tmuvtx[0].sow = sscale0 * tmu0_data[i][0] * v->v.oow;