/ comp / gb.opengl / gl / colormaterial
Gl.ColorMaterial (gb.opengl)
Syntax

    STATIC SUB ColorMaterial ( Face AS Integer, Mode AS Integer )

### Cause a material color to track the current color

#### Parameters

- Face specifies whether front, back, or both front and back material parameters should track the current color. Accepted values are Gl.GL_FRONT, Gl.GL_BACK, and Gl.GL_FRONT_AND_BACK. The default value is Gl.GL_FRONT_AND_BACK.

- Mode specifies which of several material parameters track the current color. Accepted values are Gl.GL_EMISSION, Gl.GL_AMBIENT, Gl.GL_DIFFUSE, Gl.GL_SPECULAR, and Gl.GL_AMBIENT_AND_DIFFUSE. The default value is Gl.GL_AMBIENT_AND_DIFFUSE.

#### Description

Gl.ColorMaterial specifies which material parameters track the current color. When Gl.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.GL_COLOR_MATERIAL is enabled and disabled using the commands Gl.Enable and Gl.Disable, called with Gl.GL_COLOR_MATERIAL as their argument. By default, it is disabled.

| Gl.ColorMaterial allows a subset of material parameters to be changed for each vertex using only the Gl.Color command, without calling Gl.Material. If only such a subset of parameters is to be specified for each vertex, Gl.ColorMaterial is preferred over calling Gl.Material.

#### Errors

Gl.GL_INVALID_ENUM is generated if face or mode is not an accepted value.
Gl.GL_INVALID_OPERATION is generated if Gl.ColorMaterial is called between a call to Gl.Begin and the corresponding call to Gl.End.

#### Associated Gets

Gl.IsEnabled with argument Gl.GL_COLOR_MATERIAL
Gl.GetColorMaterialParameter
Gl.GetColorMaterialFace

### See also

Gl.Color3f , Gl.Enable , Gl.Light, Gl.LightModel, Gl.Material