The glClearIndex function specifies the clear value for the color-index buffers.

void glClearIndex(
  GLfloat c


The index used when the color-index buffers are cleared. The default value is zero.


The glClearIndex function specifies the index used by glClear to clear the color-index buffers. The c parameter is not clamped. Rather, c is converted to a fixed-point value with unspecified precision to the right of the binary point. The integer part of this value is then masked with 2m 1, where m is the number of bits in a color index stored in the framebuffer.

The following functions retrieve information related to glClearIndex:

glGet with argument GL_INDEX_CLEAR_VALUE

glGet with argument GL_INDEX_BITS

Error Codes

The following is the error code generated and its condition.

Error code Condition
GL_INVALID_OPERATION glClearIndex was called between a call to glBegin and the corresponding call to glEnd.


  Windows NT/2000: Requires Windows NT 3.5 or later.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in Gl.h.
  Library: Use Opengl32.lib.

See Also

glBegin, glClear, glEnd, glGet


Community Additions