include more low-level bindings
[clinton/guile-figl.git] / upstream-man-pages / man4 / glDrawElementsIndirect.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id="glDrawElementsIndirect">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2010</year>
9 <holder>Khronos Group.</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glDrawElementsIndirect</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glDrawElementsIndirect</refname>
17 <refpurpose>render indexed primitives from array data, taking parameters from memory</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glDrawElementsIndirect</function></funcdef>
23 <paramdef>GLenum <parameter>mode</parameter></paramdef>
24 <paramdef>GLenum <parameter>type</parameter></paramdef>
25 <paramdef>const void *<parameter>indirect</parameter></paramdef>
26 </funcprototype>
27 </funcsynopsis>
28 </refsynopsisdiv>
29 <!-- eqn: ignoring delim $$ -->
30 <refsect1 id="parameters"><title>Parameters</title>
31 <variablelist>
32 <varlistentry>
33 <term><parameter>mode</parameter></term>
34 <listitem>
35 <para>
36 Specifies what kind of primitives to render.
37 Symbolic constants
38 <constant>GL_POINTS</constant>,
39 <constant>GL_LINE_STRIP</constant>,
40 <constant>GL_LINE_LOOP</constant>,
41 <constant>GL_LINES</constant>,
42 <constant>GL_LINE_STRIP_ADJACENCY</constant>,
43 <constant>GL_LINES_ADJACENCY</constant>,
44 <constant>GL_TRIANGLE_STRIP</constant>,
45 <constant>GL_TRIANGLE_FAN</constant>,
46 <constant>GL_TRIANGLES</constant>,
47 <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant>,
48 <constant>GL_TRIANGLES_ADJACENCY</constant>, and
49 <constant>GL_PATCHES</constant>
50 are accepted.
51 </para>
52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term><parameter>type</parameter></term>
56 <listitem>
57 <para>
58 Specifies the type of data in the buffer bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant> binding.
59 </para>
60 </listitem>
61 </varlistentry>
62 <varlistentry>
63 <term><parameter>indirect</parameter></term>
64 <listitem>
65 <para>
66 Specifies the address of a structure containing the draw parameters.
67 </para>
68 </listitem>
69 </varlistentry>
70 </variablelist>
71 </refsect1>
72 <refsect1 id="description"><title>Description</title>
73 <para>
74 <function>glDrawElementsIndirect</function> specifies multiple indexed geometric primitives
75 with very few subroutine calls. <function>glDrawElementsIndirect</function> behaves
76 similarly to <citerefentry><refentrytitle>glDrawElementsInstancedBaseVertexBaseInstance</refentrytitle></citerefentry>,
77 execpt that the parameters to <citerefentry><refentrytitle>glDrawElementsInstancedBaseVertexBaseInstance</refentrytitle></citerefentry>
78 are stored in memory at the address given by <parameter>indirect</parameter>.
79 </para>
80 <para>
81 The parameters addressed by <parameter>indirect</parameter> are packed into a structure
82 that takes the form (in C):
83 <programlisting><![CDATA[ typedef struct {
84 uint count;
85 uint primCount;
86 uint firstIndex;
87 uint baseVertex;
88 uint baseInstance;
89 } DrawElementsIndirectCommand;]]></programlisting>
90 <para>
91 <function>glDrawElementsIndirect</function> is equivalent to:
92 </para>
93 <programlisting><![CDATA[ void glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect)
94 {
95 const DrawElementsIndirectCommand *cmd = (const DrawElementsIndirectCommand *)indirect;
96 glDrawElementsInstancedBaseVertexBaseInstance(mode,
97 cmd->count,
98 type,
99 cmd->firstIndex + size-of-type,
100 cmd->primCount,
101 cmd->baseVertex,
102 cmd->baseInstance);
103 }]]></programlisting>
104 </para>
105 <para>
106 If a buffer is bound to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding at the time
107 of a call to <function>glDrawElementsIndirect</function>, <parameter>indirect</parameter>
108 is interpreted as an offset, in basic machine units, into that buffer and the parameter
109 data is read from the buffer rather than from client memory.
110 </para>
111 <para>
112 Note that indices stored in client memory are not supported. If no buffer is bound to the
113 <constant>GL_ELEMENT_ARRAY_BUFFER</constant> binding, an error will be generated.
114 </para>
115 <para>
116 The results of the operation are undefined if the <code>reservedMustBeZero</code> member
117 of the parameter structure is non-zero. However, no error is generated in this case.
118 </para>
119 <para>
120 Vertex attributes that are modified by <function>glDrawElementsIndirect</function> have an
121 unspecified value after <function>glDrawElementsIndirect</function> returns. Attributes that aren't
122 modified remain well defined.
123 </para>
124 </refsect1>
125 <refsect1 id="notes"><title>Notes</title>
126 <para>
127 The <parameter>baseInstance</parameter> member of the <parameter>DrawElementsIndirectCommand</parameter>
128 structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2,
129 this parameter is present but is reserved and should be set to zero. On earlier versions of the GL,
130 behavior is undefined if it is non-zero.
131 </para>
132 </refsect1>
133 <refsect1 id="errors"><title>Errors</title>
134 <para>
135 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value.
136 </para>
137 <para>
138 <constant>GL_INVALID_OPERATION</constant> is generated if no buffer is bound to the <constant>GL_ELEMENT_ARRAY_BUFFER</constant>
139 binding, or if such a buffer's data store is currently mapped.
140 </para>
141 <para>
142 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an
143 enabled array or to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding and the buffer object's data store is currently mapped.
144 </para>
145 <para>
146 <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter>
147 is incompatible with the input primitive type of the geometry shader in the currently installed program object.
148 </para>
149 <para>
150 <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mode</parameter> is <constant>GL_PATCHES</constant>
151 and no tessellation control shader is active.
152 </para>
153 </refsect1>
154 <refsect1 id="seealso"><title>See Also</title>
155 <para>
156 <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>,
157 <citerefentry><refentrytitle>glDrawArraysInstanced</refentrytitle></citerefentry>,
158 <citerefentry><refentrytitle>glDrawArraysIndirect</refentrytitle></citerefentry>,
159 <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,
160 <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>,
161 </para>
162 </refsect1>
163 <refsect1 id="Copyright"><title>Copyright</title>
164 <para>
165 Copyright <trademark class="copyright"></trademark> 2010 Khronos Group.
166 This material may be distributed subject to the terms and conditions set forth in
167 the Open Publication License, v 1.0, 8 June 1999.
168 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
169 </para>
170 </refsect1>
171 </refentry>