glArrayElement

The glArrayElement function specifies the array elements used to render a vertex.

void glArrayElement(
  GLint index);

Parameters

  • index
    An index in the enabled arrays.

Remarks

Use the glArrayElement function within glBegin and glEnd pairs to specify vertex and attribute data for point, line, and polygon primitives. The glArrayElement function specifies the data for a single vertex using vertex and attribute data located at the index of the enabled vertex arrays.

You can use glArrayElement to construct primitives by indexing vertex data, rather than by streaming through arrays of data in first-to-last order. Because glArrayElement specifies a single vertex only, you can explicitly specify attributes for individual primitives. For example, you can set a single normal for each individual triangle.

When you include calls to glArrayElement in display lists, the necessary array data, determined by the array pointers and enable values, is entered in the display list also. Array pointer and enable values are determined when display lists are created, not when display lists are executed.

You can read and cache static array data at any time with glArrayElement. When you modify the elements of a static array without specifying the array again, the results of any subsequent calls to glArrayElement are undefined.

When you call glArrayElement without first calling glEnableClientState(GL_VERTEX_ARRAY), no drawing occurs, but the attributes corresponding to enabled arrays are modified. Although no error is generated when you specify an array within glBegin and glEnd pairs, the results are undefined.

Note  The glArrayElement function is only available in OpenGL version 1.1 or later.

Requirements

**  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, glColorPointer, glDrawArrays, glEdgeFlagPointer, glEnableClientState, glEnd, glGetPointerv, glGetString, glIndexPointer, glNormalPointer, glTexCoordPointer, glVertexPointer