Causes a material color to track the current color.
OpenGL C bindings library: libGL.a
void glColorMaterial(GLenum face, GLenum mode)
The glColorMaterial subroutine specifies which material parameters track the current color. When GL_COLOR_MATERIAL 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. GL_COLOR_MATERIAL is enabled and disabled using the subroutines glEnable and glDisable, called with GL_COLOR_MATERIAL as their argument. By default it is disabled.
The glColorMaterial subroutine allows a subset of material parameters to be changed for each vertex using only the glColor subroutine, without calling glMaterial. If only such a subset of parameters is to be specified for each vertex, the use of the glColorMaterial subroutine is preferred over calling glMaterial.
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.
GL_INVALID_ENUM | face or mode is set to an unaccepted value. |
GL_INVALID_OPERATION | The glColorMaterial subroutine is called between a call to glBegin and the corresponding call to glEnd. |
Associated gets for the glColorMaterial subroutine are as follows. (See the glGet subroutine for more information.)
glIsEnabled with argument GL_COLOR_MATERIAL
glGet with argument GL_COLOR_MATERIAL_PARAMETER
glGet with argument GL_COLOR_MATERIAL_FACE.
/usr/include/GL/gl.h | Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |
The glBegin or glEnd subroutine, glColor subroutine, glEnable or glDisable subroutine, glLight subroutine, glLightModel subroutine, glMaterial subroutine.