1GLCOLORMATERIAL(3G) GLCOLORMATERIAL(3G)
2
3
4
6 glColorMaterial - cause a material color to track the current color
7
8
10 void glColorMaterial( GLenum face,
11 GLenum mode )
12
13
15 face Specifies whether front, back, or both front and back material
16 parameters should track the current color. Accepted values are
17 GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK. The initial value is
18 GL_FRONT_AND_BACK.
19
20 mode Specifies which of several material parameters track the current
21 color. Accepted values are GL_EMISSION, GL_AMBIENT, GL_DIFFUSE,
22 GL_SPECULAR, and GL_AMBIENT_AND_DIFFUSE. The initial value is
23 GL_AMBIENT_AND_DIFFUSE.
24
26 glColorMaterial specifies which material parameters track the current
27 color. When GL_COLOR_MATERIAL is enabled, the material parameter or
28 parameters specified by mode, of the material or materials specified by
29 face, track the current color at all times.
30
31 To enable and disable GL_COLOR_MATERIAL, call glEnable and glDisable
32 with argument GL_COLOR_MATERIAL. GL_COLOR_MATERIAL is initially dis‐
33 abled.
34
36 glColorMaterial makes it possible to change a subset of material param‐
37 eters for each vertex using only the glColor command, without calling
38 glMaterial. If only such a subset of parameters is to be specified for
39 each vertex, calling glColorMaterial is preferable to calling
40 glMaterial.
41
42 Call glColorMaterial before enabling GL_COLOR_MATERIAL.
43
44 Calling glDrawElements, glDrawArrays, or glDrawRangeElements may leave
45 the current color indeterminate, if the color array is enabled. If
46 glColorMaterial is enabled while the current color is indeterminate,
47 the lighting material state specified by face and mode is also indeter‐
48 minate.
49
50 If the GL version is 1.1 or greater, and GL_COLOR_MATERIAL is enabled,
51 evaluated color values affect the results of the lighting equation as
52 if the current color were being modified, but no change is made to the
53 tracking lighting parameter of the current color.
54
56 GL_INVALID_ENUM is generated if face or mode is not an accepted value.
57
58 GL_INVALID_OPERATION is generated if glColorMaterial is executed
59 between the execution of glBegin and the corresponding execution of
60 glEnd.
61
63 glIsEnabled with argument GL_COLOR_MATERIAL
64 glGet with argument GL_COLOR_MATERIAL_PARAMETER
65 glGet with argument GL_COLOR_MATERIAL_FACE
66
68 glColor(3G), glColorPointer(3G), glDrawArrays(3G), glDrawElements(3G),
69 glDrawRangeElements(3G), glEnable(3G), glLight(3G), glLightModel(3G),
70 glMaterial(3G)
71
72
73
74 GLCOLORMATERIAL(3G)