From a7c52c61e5bb5dc1f1781453b757bdb9904f6a1e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 22 Jan 2003 17:58:52 +0000 Subject: [PATCH] push/pop color table state (Eric Plante) --- src/mesa/main/attrib.c | 31 ++++++++++++++++++++++++++++--- src/mesa/main/mtypes.h | 6 +++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index aabea8c066a..c34b80a60d0 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -1,10 +1,10 @@ -/* $Id: attrib.c,v 1.75 2002/10/24 23:57:19 brianp Exp $ */ +/* $Id: attrib.c,v 1.76 2003/01/22 17:58:52 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 4.1 + * Version: 5.1 * - * Copyright (C) 1999-2002 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2003 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"), @@ -31,6 +31,7 @@ #include "blend.h" #include "buffers.h" #include "colormac.h" +#include "colortab.h" #include "context.h" #include "depth.h" #include "enable.h" @@ -137,6 +138,9 @@ _mesa_PushAttrib(GLbitfield mask) attr->Blend = ctx->Color.BlendEnabled; attr->ClipPlanes = ctx->Transform.ClipPlanesEnabled; attr->ColorMaterial = ctx->Light.ColorMaterialEnabled; + attr->ColorTable = ctx->Pixel.ColorTableEnabled; + attr->PostColorMatrixColorTable = ctx->Pixel.PostColorMatrixColorTableEnabled; + attr->PostConvolutionColorTable = ctx->Pixel.PostConvolutionColorTableEnabled; attr->Convolution1D = ctx->Pixel.Convolution1DEnabled; attr->Convolution2D = ctx->Pixel.Convolution2DEnabled; attr->Separable2D = ctx->Pixel.Separable2DEnabled; @@ -196,6 +200,7 @@ _mesa_PushAttrib(GLbitfield mask) attr->Texture[i] = ctx->Texture.Unit[i].Enabled; attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled; } + attr->TextureColorTable = ctx->Texture.ColorTableEnabled; /* GL_NV_vertex_program */ attr->VertexProgram = ctx->VertexProgram.Enabled; attr->VertexProgramPointSize = ctx->VertexProgram.PointSizeEnabled; @@ -420,6 +425,14 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Light.ColorMaterialEnabled, enable->ColorMaterial, GL_COLOR_MATERIAL); + TEST_AND_UPDATE(ctx->Pixel.ColorTableEnabled, enable->ColorTable, + GL_COLOR_TABLE); + TEST_AND_UPDATE(ctx->Pixel.PostColorMatrixColorTableEnabled, + enable->PostColorMatrixColorTable, + GL_POST_COLOR_MATRIX_COLOR_TABLE); + TEST_AND_UPDATE(ctx->Pixel.PostConvolutionColorTableEnabled, + enable->PostConvolutionColorTable, + GL_POST_CONVOLUTION_COLOR_TABLE); TEST_AND_UPDATE(ctx->Polygon.CullFlag, enable->CullFace, GL_CULL_FACE); TEST_AND_UPDATE(ctx->Depth.Test, enable->DepthTest, GL_DEPTH_TEST); TEST_AND_UPDATE(ctx->Color.DitherFlag, enable->Dither, GL_DITHER); @@ -521,6 +534,8 @@ pop_enable_group(GLcontext *ctx, const struct gl_enable_attrib *enable) TEST_AND_UPDATE(ctx->Multisample.SampleCoverageInvert, enable->SampleCoverageInvert, GL_SAMPLE_COVERAGE_INVERT_ARB); + TEST_AND_UPDATE(ctx->Texture.ColorTableEnabled, enable->TextureColorTable, + GL_TEXTURE_COLOR_TABLE_SGI); /* GL_NV_vertex_program */ TEST_AND_UPDATE(ctx->VertexProgram.Enabled, enable->VertexProgram, @@ -613,6 +628,16 @@ pop_texture_group(GLcontext *ctx, const struct gl_texture_attrib *texAttrib) _mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE_NV, (GLboolean) (unit->Enabled & TEXTURE_RECT_BIT ? GL_TRUE : GL_FALSE)); } + if (ctx->Extensions.SGI_texture_color_table) { + _mesa_set_enable(ctx, GL_TEXTURE_COLOR_TABLE_SGI, + texAttrib->ColorTableEnabled); + _mesa_ColorTableParameterfv(GL_TEXTURE_COLOR_TABLE_SGI, + GL_COLOR_TABLE_SCALE_SGI, + texAttrib->ColorTableScale); + _mesa_ColorTableParameterfv(GL_TEXTURE_COLOR_TABLE_SGI, + GL_COLOR_TABLE_BIAS_SGI, + texAttrib->ColorTableBias); + } _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, unit->EnvMode); _mesa_TexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, unit->EnvColor); _mesa_TexGeni(GL_S, GL_TEXTURE_GEN_MODE, unit->GenModeS); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 37268c2afc2..ba80d952874 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,4 +1,4 @@ -/* $Id: mtypes.h,v 1.100 2003/01/21 21:47:50 brianp Exp $ */ +/* $Id: mtypes.h,v 1.101 2003/01/22 17:58:52 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -381,6 +381,9 @@ struct gl_enable_attrib { GLboolean Blend; GLuint ClipPlanes; GLboolean ColorMaterial; + GLboolean ColorTable; /* SGI_color_table */ + GLboolean PostColorMatrixColorTable; /* SGI_color_table */ + GLboolean PostConvolutionColorTable; /* SGI_color_table */ GLboolean Convolution1D; GLboolean Convolution2D; GLboolean Separable2D; @@ -435,6 +438,7 @@ struct gl_enable_attrib { GLboolean RasterPositionUnclipped; /* GL_IBM_rasterpos_clip */ GLuint Texture[MAX_TEXTURE_IMAGE_UNITS]; GLuint TexGen[MAX_TEXTURE_COORD_UNITS]; + GLboolean TextureColorTable; /* SGI_texture_color_table */ GLboolean VertexProgram; /* GL_NV_vertex_program */ GLboolean VertexProgramPointSize; /* GL_NV_vertex_program */ GLboolean VertexProgramTwoSide; /* GL_NV_vertex_program */ -- 2.30.2