diff options
author | Brian Paul <[email protected]> | 2003-07-23 17:13:48 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2003-07-23 17:13:48 +0000 |
commit | 9f9bed9c8ea8a1baa922320debbf04128b2b58de (patch) | |
tree | c0600de102d663cfc781965e8e36777d69f7ca22 | |
parent | d19b5db5dce92efd55359607006a32076dc95d12 (diff) |
fix GL_SGI_texture_colortable bugs
-rw-r--r-- | src/mesa/main/pixel.c | 3 | ||||
-rw-r--r-- | src/mesa/swrast/s_texture.c | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index ce4be7eadc8..31ab8d7a72c 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -1489,6 +1489,9 @@ void _mesa_init_pixel( GLcontext * ctx ) } ASSIGN_4V(ctx->Pixel.PostConvolutionScale, 1.0, 1.0, 1.0, 1.0); ASSIGN_4V(ctx->Pixel.PostConvolutionBias, 0.0, 0.0, 0.0, 0.0); + /* GL_SGI_texture_color_table */ + ASSIGN_4V(ctx->Pixel.TextureColorTableScale, 1.0, 1.0, 1.0, 1.0); + ASSIGN_4V(ctx->Pixel.TextureColorTableBias, 0.0, 0.0, 0.0, 0.0); /* Pixel transfer */ ctx->Pack.Alignment = 4; diff --git a/src/mesa/swrast/s_texture.c b/src/mesa/swrast/s_texture.c index 1343b289fbd..cb124724624 100644 --- a/src/mesa/swrast/s_texture.c +++ b/src/mesa/swrast/s_texture.c @@ -533,19 +533,19 @@ _swrast_texture_table_lookup(const struct gl_color_table *table, break; case GL_RGBA: /* replace RGBA with RGBA */ - if (!table->FloatTable) { + if (table->FloatTable) { const GLfloat scale = (GLfloat) (table->Size - 1) / CHAN_MAXF; - const GLchan *lut = (const GLchan *) table->Table; + const GLfloat *lut = (const GLfloat *) table->Table; GLuint i; for (i = 0; i < n; i++) { GLint jR = IROUND((GLfloat) rgba[i][RCOMP] * scale); GLint jG = IROUND((GLfloat) rgba[i][GCOMP] * scale); GLint jB = IROUND((GLfloat) rgba[i][BCOMP] * scale); GLint jA = IROUND((GLfloat) rgba[i][ACOMP] * scale); - rgba[i][RCOMP] = lut[jR * 4 + 0]; - rgba[i][GCOMP] = lut[jG * 4 + 1]; - rgba[i][BCOMP] = lut[jB * 4 + 2]; - rgba[i][ACOMP] = lut[jA * 4 + 3]; + CLAMPED_FLOAT_TO_CHAN(rgba[i][RCOMP], lut[jR * 4 + 0]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][GCOMP], lut[jG * 4 + 1]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][BCOMP], lut[jB * 4 + 2]); + CLAMPED_FLOAT_TO_CHAN(rgba[i][ACOMP], lut[jA * 4 + 3]); } } else { |