glIndexPointer function

The glIndexPointer function defines an array of color indexes.

Syntax

void WINAPI glIndexPointer(
         GLenum  type,
         GLsizei stride,
   const GLvoid  *pointer
);

Parameters

type

The data type of each color index in the array using the following symbolic constants: GL_SHORT, GL_INT, GL_FLOAT, GL_DOUBLE.

stride

The byte offset between consecutive color indexes. When stride is zero, the color indexes are tightly packed in the array.

pointer

A pointer to the first color index in the array.

Return value

This function does not return a value.

Error codes

The following error codes can be retrieved by the glGetError function.

Name Meaning
GL_INVALID_ENUM
type was not an accepted value.
GL_INVALID_VALUE
stride or count was negative.

Remarks

The glIndexPointer function specifies the location and data of an array of color indexes to use when rendering. The type parameter specifies the data type of each color index and stride determines the byte offset from one color index to the next, enabling the packing of vertices and attributes in a single array or storage in separate arrays. In some implementations, storing the vertices and attributes in a single array can be more efficient than using separate arrays. For more information, see glInterleavedArrays.

A color-index array is enabled when you specify the GL_INDEX_ARRAY constant with glEnableClientState. When enabled, glDrawArrays and glArrayElement use the color-index array. By default the color-index array is disabled.

You cannot include glIndexPointer in display lists.

When you specify a color-index array using glIndexPointer, the values of all the function's color-index array parameters are saved in a client-side state and static array elements can be cached. Because the color-index array parameters are client-side state, their values are not saved or restored by glPushAttrib and glPopAttrib.

Although no error is generated when you call glIndexPointer within glBegin and glEnd pairs, the results are undefined.

The following functions retrieve information related to glIndexPointer:

glIsEnabled with argument GL_INDEX_ARRAY

glGet with argument GL_INDEX_ARRAY_STRIDE

glGet with argument GL_INDEX_ARRAY_COUNT

glGet with argument GL_INDEX_ARRAY_TYPE

glGet with argument GL_INDEX_ARRAY_SIZE

glGetPointerv with argument GL_INDEX_ARRAY_POINTER

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Gl.h
Library
Opengl32.lib
DLL
Opengl32.dll

See also

glArrayElement

glColorPointer

glDrawArrays

glEdgeFlagPointer

glGetPointerv

glGetString

glNormalPointer

glPushAttrib

glTexCoordPointer

glVertexPointer