Commit | Line | Data |
---|---|---|
7faf1d71 AW |
1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd"> | |
3 | <!-- saved from url=(0013)about:internet --> | |
4 | <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="stylesheet" type="text/css" href="opengl-man.css" /><title>glDrawElementsIndirect - OpenGL 4 Reference Pages</title><meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glDrawElementsIndirect"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glDrawElementsIndirect — render indexed primitives from array data, taking parameters from memory</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glDrawElementsIndirect</b>(</code></td><td>GLenum </td><td><var class="pdparam">mode</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>const void * </td><td><var class="pdparam">indirect</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>mode</code></em></span></dt><dd><p> | |
5 | Specifies what kind of primitives to render. | |
6 | Symbolic constants | |
7 | <code class="constant">GL_POINTS</code>, | |
8 | <code class="constant">GL_LINE_STRIP</code>, | |
9 | <code class="constant">GL_LINE_LOOP</code>, | |
10 | <code class="constant">GL_LINES</code>, | |
11 | <code class="constant">GL_LINE_STRIP_ADJACENCY</code>, | |
12 | <code class="constant">GL_LINES_ADJACENCY</code>, | |
13 | <code class="constant">GL_TRIANGLE_STRIP</code>, | |
14 | <code class="constant">GL_TRIANGLE_FAN</code>, | |
15 | <code class="constant">GL_TRIANGLES</code>, | |
16 | <code class="constant">GL_TRIANGLE_STRIP_ADJACENCY</code>, | |
17 | <code class="constant">GL_TRIANGLES_ADJACENCY</code>, and | |
18 | <code class="constant">GL_PATCHES</code> | |
19 | are accepted. | |
20 | </p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p> | |
21 | Specifies the type of data in the buffer bound to the <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code> binding. | |
22 | </p></dd><dt><span class="term"><em class="parameter"><code>indirect</code></em></span></dt><dd><p> | |
23 | Specifies the address of a structure containing the draw parameters. | |
24 | </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p> | |
25 | <code class="function">glDrawElementsIndirect</code> specifies multiple indexed geometric primitives | |
26 | with very few subroutine calls. <code class="function">glDrawElementsIndirect</code> behaves | |
27 | similarly to <a href="glDrawElementsInstancedBaseVertexBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElementsInstancedBaseVertexBaseInstance</span></span></a>, | |
28 | execpt that the parameters to <a href="glDrawElementsInstancedBaseVertexBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElementsInstancedBaseVertexBaseInstance</span></span></a> | |
29 | are stored in memory at the address given by <em class="parameter"><code>indirect</code></em>. | |
30 | </p><p> | |
31 | The parameters addressed by <em class="parameter"><code>indirect</code></em> are packed into a structure | |
32 | that takes the form (in C): | |
33 | </p><pre class="programlisting"> typedef struct { | |
34 | uint count; | |
35 | uint primCount; | |
36 | uint firstIndex; | |
37 | uint baseVertex; | |
38 | uint baseInstance; | |
39 | } DrawElementsIndirectCommand;</pre><p> | |
40 | </p><p> | |
41 | <code class="function">glDrawElementsIndirect</code> is equivalent to: | |
42 | </p><p> | |
43 | </p><pre class="programlisting"> void glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect) | |
44 | { | |
45 | const DrawElementsIndirectCommand *cmd = (const DrawElementsIndirectCommand *)indirect; | |
46 | glDrawElementsInstancedBaseVertexBaseInstance(mode, | |
47 | cmd->count, | |
48 | type, | |
49 | cmd->firstIndex + size-of-type, | |
50 | cmd->primCount, | |
51 | cmd->baseVertex, | |
52 | cmd->baseInstance); | |
53 | }</pre><p> | |
54 | </p><p> | |
55 | If a buffer is bound to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding at the time | |
56 | of a call to <code class="function">glDrawElementsIndirect</code>, <em class="parameter"><code>indirect</code></em> | |
57 | is interpreted as an offset, in basic machine units, into that buffer and the parameter | |
58 | data is read from the buffer rather than from client memory. | |
59 | </p><p> | |
60 | Note that indices stored in client memory are not supported. If no buffer is bound to the | |
61 | <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code> binding, an error will be generated. | |
62 | </p><p> | |
63 | The results of the operation are undefined if the <code class="code">reservedMustBeZero</code> member | |
64 | of the parameter structure is non-zero. However, no error is generated in this case. | |
65 | </p><p> | |
66 | Vertex attributes that are modified by <code class="function">glDrawElementsIndirect</code> have an | |
67 | unspecified value after <code class="function">glDrawElementsIndirect</code> returns. Attributes that aren't | |
68 | modified remain well defined. | |
69 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p> | |
70 | The <em class="parameter"><code>baseInstance</code></em> member of the <em class="parameter"><code>DrawElementsIndirectCommand</code></em> | |
71 | structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2, | |
72 | this parameter is present but is reserved and should be set to zero. On earlier versions of the GL, | |
73 | behavior is undefined if it is non-zero. | |
74 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p> | |
75 | <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>mode</code></em> is not an accepted value. | |
76 | </p><p> | |
77 | <code class="constant">GL_INVALID_OPERATION</code> is generated if no buffer is bound to the <code class="constant">GL_ELEMENT_ARRAY_BUFFER</code> | |
78 | binding, or if such a buffer's data store is currently mapped. | |
79 | </p><p> | |
80 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to an | |
81 | enabled array or to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding and the buffer object's data store is currently mapped. | |
82 | </p><p> | |
83 | <code class="constant">GL_INVALID_OPERATION</code> is generated if a geometry shader is active and <em class="parameter"><code>mode</code></em> | |
84 | is incompatible with the input primitive type of the geometry shader in the currently installed program object. | |
85 | </p><p> | |
86 | <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>mode</code></em> is <code class="constant">GL_PATCHES</code> | |
87 | and no tessellation control shader is active. | |
88 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p> | |
89 | <a href="glDrawArrays.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArrays</span></span></a>, | |
90 | <a href="glDrawArraysInstanced.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstanced</span></span></a>, | |
91 | <a href="glDrawArraysIndirect.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysIndirect</span></span></a>, | |
92 | <a href="glDrawElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElements</span></span></a>, | |
93 | <a href="glDrawRangeElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawRangeElements</span></span></a>, | |
94 | </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p> | |
95 | Copyright <span class="trademark"></span>© 2010 Khronos Group. | |
96 | This material may be distributed subject to the terms and conditions set forth in | |
97 | the Open Publication License, v 1.0, 8 June 1999. | |
98 | <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>. | |
99 | </p></div></div></body></html> |