1GLCOLORMATERIAL(3G) OpenGL Manual GLCOLORMATERIAL(3G)
2
3
4
6 glColorMaterial - cause a material color to track the current color
7
9 void glColorMaterial(GLenum face, GLenum mode);
10
12 face
13 Specifies whether front, back, or both front and back material
14 parameters should track the current color. Accepted values are
15 GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK. The initial value is
16 GL_FRONT_AND_BACK.
17
18 mode
19 Specifies which of several material parameters track the current
20 color. Accepted values are GL_EMISSION, GL_AMBIENT, GL_DIFFUSE,
21 GL_SPECULAR, and GL_AMBIENT_AND_DIFFUSE. The initial value is
22 GL_AMBIENT_AND_DIFFUSE.
23
25 glColorMaterial specifies which material parameters track the current
26 color. When GL_COLOR_MATERIAL is enabled, the material parameter or
27 parameters specified by mode, of the material or materials specified by
28 face, track the current color at all times.
29
30 To enable and disable GL_COLOR_MATERIAL, call glEnable() and
31 glDisable() with argument GL_COLOR_MATERIAL. GL_COLOR_MATERIAL is
32 initially disabled.
33
35 glColorMaterial makes it possible to change a subset of material
36 parameters for each vertex using only the glColor() command, without
37 calling glMaterial(). If only such a subset of parameters is to be
38 specified for each vertex, calling glColorMaterial is preferable to
39 calling glMaterial().
40
41 Call glColorMaterial before enabling GL_COLOR_MATERIAL.
42
43 Calling glDrawElements(), glDrawArrays(), or glDrawRangeElements() may
44 leave the current color indeterminate, if the color array is enabled.
45 If glColorMaterial is enabled while the current color is indeterminate,
46 the lighting material state specified by face and mode is also
47 indeterminate.
48
49 If the GL version is 1.1 or greater, and GL_COLOR_MATERIAL is enabled,
50 evaluated color values affect the results of the lighting equation as
51 if the current color were being modified, but no change is made to the
52 tracking lighting parameter of the current color.
53
55 GL_INVALID_ENUM is generated if face or mode is not an accepted value.
56
57 GL_INVALID_OPERATION is generated if glColorMaterial is executed
58 between the execution of glBegin() and the corresponding execution of
59 glEnd().
60
62 glIsEnabled() with argument GL_COLOR_MATERIAL
63
64 glGet() with argument GL_COLOR_MATERIAL_PARAMETER
65
66 glGet() with argument GL_COLOR_MATERIAL_FACE
67
69 glColor(), glColorPointer(), glDrawArrays(), glDrawElements(),
70 glDrawRangeElements(), glEnable(), glLight(), glLightModel(),
71 glMaterial()
72
74 Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed
75 under the SGI Free Software B License. For details, see
76 http://oss.sgi.com/projects/FreeB/.
77
79 opengl.org
80
81
82
83opengl.org 06/10/2014 GLCOLORMATERIAL(3G)