-/* $Id: attrib.c,v 1.75 2002/10/24 23:57:19 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"),
#include "blend.h"
#include "buffers.h"
#include "colormac.h"
+#include "colortab.h"
#include "context.h"
#include "depth.h"
#include "enable.h"
}
-void
+void GLAPIENTRY
_mesa_PushAttrib(GLbitfield mask)
{
struct gl_attrib_node *newnode;
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;
for (i=0; i<MAX_TEXTURE_UNITS; i++) {
attr->Texture[i] = ctx->Texture.Unit[i].Enabled;
attr->TexGen[i] = ctx->Texture.Unit[i].TexGenEnabled;
+ attr->TextureColorTable[i] = ctx->Texture.Unit[i].ColorTableEnabled;
}
/* GL_NV_vertex_program */
attr->VertexProgram = ctx->VertexProgram.Enabled;
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);
GL_POINT_SMOOTH);
TEST_AND_UPDATE(ctx->Point.SmoothFlag, enable->PointSmooth,
GL_POINT_SMOOTH);
- if (ctx->Extensions.NV_point_sprite) {
+ if (ctx->Extensions.NV_point_sprite || ctx->Extensions.ARB_point_sprite) {
TEST_AND_UPDATE(ctx->Point.PointSprite, enable->PointSprite,
GL_POINT_SPRITE_NV);
}
(*ctx->Driver.Enable)( ctx, GL_TEXTURE_GEN_Q, GL_FALSE);
}
}
+
+ /* GL_SGI_texture_color_table */
+ ctx->Texture.Unit[i].ColorTableEnabled = enable->TextureColorTable[i];
}
if (ctx->Driver.ActiveTexture) {
_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,
+ unit->ColorTableEnabled);
+ }
_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);
* We could at least check if the value to restore equals the current value
* and then skip the Mesa call.
*/
-void
+void GLAPIENTRY
_mesa_PopAttrib(void)
{
struct gl_attrib_node *attr, *next;
_mesa_LightModelf(GL_LIGHT_MODEL_COLOR_CONTROL,
(GLfloat) light->Model.ColorControl);
/* materials */
- MEMCPY(ctx->Light.Material, light->Material,
- 2 * sizeof(struct gl_material));
+ MEMCPY(&ctx->Light.Material, &light->Material,
+ sizeof(struct gl_material));
/* shade model */
_mesa_ShadeModel(light->ShadeModel);
/* color material */
_mesa_PointParameterfEXT(GL_POINT_FADE_THRESHOLD_SIZE_EXT,
point->Threshold);
}
- if (ctx->Extensions.NV_point_sprite) {
+ if (ctx->Extensions.NV_point_sprite
+ || ctx->Extensions.ARB_point_sprite) {
GLuint u;
for (u = 0; u < ctx->Const.MaxTextureUnits; u++) {
_mesa_TexEnvi(GL_POINT_SPRITE_NV, GL_COORD_REPLACE_NV,
#define GL_CLIENT_UNPACK_BIT (1<<21)
-void
+void GLAPIENTRY
_mesa_PushClientAttrib(GLbitfield mask)
{
struct gl_attrib_node *newnode;
-void
+void GLAPIENTRY
_mesa_PopClientAttrib(void)
{
struct gl_attrib_node *attr, *next;
attr = next;
}
}
+
+
+void _mesa_init_attrib( GLcontext *ctx )
+{
+ /* Renderer and client attribute stacks */
+ ctx->AttribStackDepth = 0;
+ ctx->ClientAttribStackDepth = 0;
+}