1GLDRAWELEMENTS(3G) GLDRAWELEMENTS(3G)
2
3
4
6 glDrawElements - render primitives from array data
7
8
10 void glDrawElements( GLenum mode,
11 GLsizei count,
12 GLenum type,
13 const GLvoid *indices )
14
15
17 mode Specifies what kind of primitives to render. Symbolic con‐
18 stants GL_POINTS, GL_LINE_STRIP, GL_LINE_LOOP, GL_LINES,
19 GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, GL_TRIANGLES,
20 GL_QUAD_STRIP, GL_QUADS, and GL_POLYGON are accepted.
21
22 count Specifies the number of elements to be rendered.
23
24 type Specifies the type of the values in indices. Must be one of
25 GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, or GL_UNSIGNED_INT.
26
27 indices Specifies a pointer to the location where the indices are
28 stored.
29
31 glDrawElements specifies multiple geometric primitives with very few
32 subroutine calls. Instead of calling a GL function to pass each indi‐
33 vidual vertex, normal, texture coordinate, edge flag, or color, you can
34 prespecify separate arrays of vertices, normals, and so on and use them
35 to construct a sequence of primitives with a single call to
36 glDrawElements.
37
38 When glDrawElements is called, it uses count sequential elements from
39 an enabled array, starting at indices to construct a sequence of geo‐
40 metric primitives. mode specifies what kind of primitives are con‐
41 structed, and how the array elements construct these primitives. If
42 more than one array is enabled, each is used. If GL_VERTEX_ARRAY is not
43 enabled, no geometric primitives are constructed.
44
45 Vertex attributes that are modified by glDrawElements have an unspeci‐
46 fied value after glDrawElements returns. For example, if GL_COLOR_ARRAY
47 is enabled, the value of the current color is undefined after
48 glDrawElements executes. Attributes that aren't modified maintain their
49 previous values.
50
52 glDrawElements is available only if the GL version is 1.1 or greater.
53
54 glDrawElements is included in display lists. If glDrawElements is
55 entered into a display list, the necessary array data (determined by
56 the array pointers and enables) is also entered into the display list.
57 Because the array pointers and enables are client-side state, their
58 values affect display lists when the lists are created, not when the
59 lists are executed.
60
62 GL_INVALID_ENUM is generated if mode is not an accepted value.
63
64 GL_INVALID_VALUE is generated if count is negative.
65
66 GL_INVALID_OPERATION is generated if glDrawElements is executed between
67 the execution of glBegin and the corresponding glEnd.
68
70 glArrayElement(3G), glColorPointer(3G), glDrawArrays(3G),
71 glDrawRangeElements(3G), glEdgeFlagPointer(3G), glGetPointerv(3G),
72 glIndexPointer(3G), glInterleavedArrays(3G), glNormalPointer(3G),
73 glTexCoordPointer(3G), glVertexPointer(3G)
74
75
76
77
78 GLDRAWELEMENTS(3G)