glColorMaterial(3G) OpenGL Reference glColorMaterial(3G)
NAME
glColorMaterial - cause a material color to track the current color
C SPECIFICATION
void glColorMaterial( GLenum face,
GLenum mode )
PARAMETERS
face Specifies whether front, back, or both front and back material
parameters should track the current color. Accepted values are
GLFRONT, GLBACK, and GLFRONTANDBACK. The initial value is
GLFRONTANDBACK.
mode Specifies which of several material parameters track the current
color. Accepted values are GLEMISSION, GLAMBIENT, GLDIFFUSE,
GLSPECULAR, and GLAMBIENTANDDIFFUSE. The initial value is
GLAMBIENTANDDIFFUSE.
DESCRIPTION
glColorMaterial specifies which material parameters track the current
color. When GLCOLORMATERIAL is enabled, the material parameter or
parameters specified by mode, of the material or materials specified by
face, track the current color at all times.
To enable and disable GLCOLORMATERIAL, call glEnable and glDisable with
argument GLCOLORMATERIAL. GLCOLORMATERIAL is initially disabled.
NOTES
glColorMaterial makes it possible to change a subset of material
parameters for each vertex using only the glColor command, without
calling glMaterial. If only such a subset of parameters is to be
specified for each vertex, calling glColorMaterial is preferable to
calling glMaterial.
Call glColorMaterial before enabling GLCOLORMATERIAL.
Calling glDrawElements may leave the current color indeterminate. If
glColorMaterial is enabled while the current color is indeterminate, the
lighting material state specified by face and mode is also indeterminate.
If the GL version is 1.1 or greater, and GLCOLORMATERIAL is enabled,
evaluated color values affect the results of the lighting equation as if
the current color were being modified, but no change is made to the
tracking lighting parameter of the current color.
ERRORS
GLINVALIDENUM is generated if face or mode is not an accepted value.
Page 1
glColorMaterial(3G) OpenGL Reference glColorMaterial(3G)
GLINVALIDOPERATION is generated if glColorMaterial is executed between
the execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED GETS
glIsEnabled with argument GLCOLORMATERIAL
glGet with argument GLCOLORMATERIALPARAMETER
glGet with argument GLCOLORMATERIALFACE
MACHINE DEPENDENCIES
On RealityEngine, RealityEngine2, and VTX systems, GLAMBIENTANDDIFFUSE
mode does not work correctly.
SEE ALSO
glColor, glColorPointer, glDrawElements, glEnable, glLight, glLightModel,
glMaterial
Page 2