summaryrefslogtreecommitdiff
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <brian.paul@tungstengraphics.com>2006-10-22 17:18:50 +0000
committerBrian Paul <brian.paul@tungstengraphics.com>2006-10-22 17:18:50 +0000
commit0b26e826bda0da7aeec9a79ee07fe21d54bb1263 (patch)
treecad7fe6571832fc55e6916f024aa1d1365ea410f /src/mesa/main
parent919cd2c3ba39bf4d8d2ffcea0daec7bab8645d34 (diff)
Color clamping fixes.
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/blend.c31
-rw-r--r--src/mesa/main/blend.h9
-rw-r--r--src/mesa/main/light.c1
-rw-r--r--src/mesa/main/mtypes.h1
4 files changed, 40 insertions, 2 deletions
diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index bf886af9e8..81bd4c2f32 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -516,6 +516,37 @@ _mesa_ColorMask( GLboolean red, GLboolean green,
}
+extern void GLAPIENTRY
+_mesa_ClampColorARB(GLenum target, GLenum clamp)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ ASSERT_OUTSIDE_BEGIN_END(ctx);
+
+ if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) {
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)");
+ return;
+ }
+
+ switch (target) {
+ case GL_CLAMP_VERTEX_COLOR_ARB:
+ ctx->Light.ClampVertexColor = clamp;
+ break;
+ case GL_CLAMP_FRAGMENT_COLOR_ARB:
+ ctx->Color.ClampFragmentColor = clamp;
+ break;
+ case GL_CLAMP_READ_COLOR_ARB:
+ ctx->Color.ClampReadColor = clamp;
+ break;
+ default:
+ _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(target)");
+ return;
+ }
+}
+
+
+
+
/**********************************************************************/
/** \name Initialization */
/*@{*/
diff --git a/src/mesa/main/blend.h b/src/mesa/main/blend.h
index d6c03d903f..5c0f2783a7 100644
--- a/src/mesa/main/blend.h
+++ b/src/mesa/main/blend.h
@@ -5,9 +5,9 @@
/*
* Mesa 3-D graphics library
- * Version: 3.5
+ * Version: 6.5.2
*
- * Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
+ * Copyright (C) 1999-2006 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"),
@@ -72,6 +72,11 @@ extern void GLAPIENTRY
_mesa_ColorMask( GLboolean red, GLboolean green,
GLboolean blue, GLboolean alpha );
+
+extern void GLAPIENTRY
+_mesa_ClampColorARB(GLenum target, GLenum clamp);
+
+
extern void
_mesa_init_color( GLcontext * ctx );
diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c
index 63f88b7229..984f7b2abc 100644
--- a/src/mesa/main/light.c
+++ b/src/mesa/main/light.c
@@ -1340,6 +1340,7 @@ _mesa_init_lighting( GLcontext *ctx )
NULL );
ctx->Light.ColorMaterialEnabled = GL_FALSE;
+ ctx->Light.ClampVertexColor = GL_TRUE;
/* Lighting miscellaneous */
ctx->_ShineTabList = MALLOC_STRUCT( gl_shine_tab );
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index bedc860599..5a326ff0dc 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -888,6 +888,7 @@ struct gl_light_attrib
GLenum ColorMaterialMode; /**< GL_AMBIENT, GL_DIFFUSE, etc */
GLbitfield ColorMaterialBitmask; /**< bitmask formed from Face and Mode */
GLboolean ColorMaterialEnabled;
+ GLenum ClampVertexColor;
struct gl_light EnabledList; /**< List sentinel */