Light | Dark

# docs.GL

OpenGL 3
OpenGL 2

# glIndex

## Name

glIndex — set the current color index

## C Specification

`void glIndexs(` | GLshort | c`)`;

`void glIndexi(` | GLint | c`)`;

`void glIndexf(` | GLfloat | c`)`;

`void glIndexd(` | GLdouble | c`)`;

`void glIndexub(` | GLubyte | c`)`;

## Parameters

`c`

  Specifies the new value for the current color index.

## C Specification

`void glIndexsv(` | const GLshort * | c`)`;

`void glIndexiv(` | const GLint * | c`)`;

`void glIndexfv(` | const GLfloat * | c`)`;

`void glIndexdv(` | const GLdouble * | c`)`;

`void glIndexubv(` | const GLubyte * | c`)`;

## Parameters

`c`

  Specifies a pointer to a one-element array that contains the new value for the current color index.

## Description

`glIndex` updates the current (single-valued) color index. It takes one argument, the new value for the current color index.

The current index is stored as a floating-point value. Integer values are converted directly to floating-point values, with no special mapping. The initial value is 1.

Index values outside the representable range of the color index buffer are not clamped. However, before an index is dithered (if enabled) and written to the frame buffer, it is converted to fixed-point format. Any bits in the integer portion of the resulting fixed-point value that do not correspond to bits in the frame buffer are masked out.

## Notes

`glIndexub` and `glIndexubv` are available only if the GL version is 1.1 or greater.

The current index can be updated at any time. In particular, `glIndex` can be called between a call to glBegin and the corresponding call to glEnd.

## Associated Gets

glGet with argument `GL_CURRENT_INDEX`

## See Also

glColor, glIndexPointer

## Copyright

Copyright © 1991-2006 Silicon Graphics, Inc. This document is licensed under the SGI Free Software B License. For details, see https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/.

Think you can improve this page? Edit this page on GitHub.