glDrawElements
- render primitives from array data
void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid * indices)
mode
Specifies what kind of primitives to render. Symbolic constants GL_POINTS
, GL_LINE_STRIP
, GL_LINE_LOOP
, GL_LINES
, GL_TRIANGLE_STRIP
, GL_TRIANGLE_FAN
, and GL_TRIANGLES
are accepted.
count
Specifies the number of elements to be rendered.
type
Specifies the type of the values in indices
. Must be either GL_UNSIGNED_BYTE
or GL_UNSIGNED_SHORT
.
indices
Specifies a pointer to the location where the indices are stored.
glDrawElements
specifies multiple geometric primitives with very few subroutine calls. You can prespecify separate arrays of vertices, normals, colors, and texture coordinates and use them to construct a sequence of primitives with a single call to glDrawElements
.
When glDrawElements
is called, it uses count
sequential indices from indices
to lookup elements in enabled arrays to construct a sequence of geometric primitives. mode
specifies what kind of primitives are constructed, and how the array elements construct these primitives. If GL_VERTEX_ARRAY
is not enabled, no geometric primitives are constructed.
Vertex attributes that are modified by glDrawElements
have an unspecified value after glDrawElements
returns. For example, if GL_COLOR_ARRAY
is enabled, the value of the current color is undefined after glDrawElements
executes. Attributes that aren't modified maintain their previous values.
GL_INVALID_ENUM
is generated if mode
is not an accepted value.
GL_INVALID_ENUM
is generated if type
is not an accepted value.
GL_INVALID_VALUE
is generated if count
is negative.
Copyright © 2003-2004 Silicon Graphics, Inc.
This document is licensed under the SGI Free Software B License. For details, see http://oss.sgi.com/projects/FreeB/.
glClientActiveTexture
, glColorPointer
, glDrawArrays
, glNormalPointer
, glTexCoordPointer
, glVertexPointer