[ Previous | Next | Contents | Glossary | Home | Search ]
OpenGL 1.1 for AIX: Reference Manual

glColorMaterial Subroutine

Purpose

Causes a material color to track the current color.

Library

OpenGL C bindings library: libGL.a

C Syntax

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 GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK. The default value is GL_FRONT_AND_BACK.
mode Specifies which of several material parameters will track the current color. Accepted values are GL_EMISSION, GL_AMBIENT, GL_DIFFUSE, GL_SPECULAR, and GL_AMBIENT_AND_DIFFUSE. The default value is GL_AMBIENT_AND_DIFFUSE.

Description

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.

Notes

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.

Errors

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

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.

Files

/usr/include/GL/gl.h Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL.

Related Information

The glBegin or glEnd subroutine, glColor subroutine, glEnable or glDisable subroutine, glLight subroutine, glLightModel subroutine, glMaterial subroutine.

OpenGL Overview.


[ Previous | Next | Contents | Glossary | Home | Search ]