Commit | Line | Data |
---|---|---|
7faf1d71 AW |
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="glDrawArraysIndirect"> | |
5 | <refmeta> | |
6 | <refmetainfo> | |
7 | <copyright> | |
8 | <year>2010</year> | |
9 | <holder>Khronos Group.</holder> | |
10 | </copyright> | |
11 | </refmetainfo> | |
12 | <refentrytitle>glDrawArraysIndirect</refentrytitle> | |
13 | <manvolnum>3G</manvolnum> | |
14 | </refmeta> | |
15 | <refnamediv> | |
16 | <refname>glDrawArraysIndirect</refname> | |
17 | <refpurpose>render 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>glDrawArraysIndirect</function></funcdef> | |
23 | <paramdef>GLenum <parameter>mode</parameter></paramdef> | |
24 | <paramdef>const void *<parameter>indirect</parameter></paramdef> | |
25 | </funcprototype> | |
26 | </funcsynopsis> | |
27 | </refsynopsisdiv> | |
28 | <!-- eqn: ignoring delim $$ --> | |
29 | <refsect1 id="parameters"><title>Parameters</title> | |
30 | <variablelist> | |
31 | <varlistentry> | |
32 | <term><parameter>mode</parameter></term> | |
33 | <listitem> | |
34 | <para> | |
35 | Specifies what kind of primitives to render. | |
36 | Symbolic constants | |
37 | <constant>GL_POINTS</constant>, | |
38 | <constant>GL_LINE_STRIP</constant>, | |
39 | <constant>GL_LINE_LOOP</constant>, | |
40 | <constant>GL_LINES</constant>, | |
41 | <constant>GL_LINE_STRIP_ADJACENCY</constant>, | |
42 | <constant>GL_LINES_ADJACENCY</constant>, | |
43 | <constant>GL_TRIANGLE_STRIP</constant>, | |
44 | <constant>GL_TRIANGLE_FAN</constant>, | |
45 | <constant>GL_TRIANGLES</constant>, | |
46 | <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant>, | |
47 | <constant>GL_TRIANGLES_ADJACENCY</constant>, and | |
48 | <constant>GL_PATCHES</constant> | |
49 | are accepted. | |
50 | </para> | |
51 | </listitem> | |
52 | </varlistentry> | |
53 | <varlistentry> | |
54 | <term><parameter>indirect</parameter></term> | |
55 | <listitem> | |
56 | <para> | |
57 | Specifies the address of a structure containing the draw parameters. | |
58 | </para> | |
59 | </listitem> | |
60 | </varlistentry> | |
61 | </variablelist> | |
62 | </refsect1> | |
63 | <refsect1 id="description"><title>Description</title> | |
64 | <para> | |
65 | <function>glDrawArraysIndirect</function> specifies multiple geometric primitives | |
66 | with very few subroutine calls. <function>glDrawArraysIndirect</function> behaves | |
67 | similarly to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry>, | |
68 | execept that the parameters to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry> | |
69 | are stored in memory at the address given by <parameter>indirect</parameter>. | |
70 | </para> | |
71 | <para> | |
72 | The parameters addressed by <parameter>indirect</parameter> are packed into a structure | |
73 | that takes the form (in C): | |
74 | <programlisting><![CDATA[ typedef struct { | |
75 | uint count; | |
76 | uint primCount; | |
77 | uint first; | |
78 | uint baseInstance; | |
79 | } DrawArraysIndirectCommand; | |
80 | ||
81 | const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect; | |
82 | glDrawArraysInstancedBaseInstance(mode, cmd->first, cmd->count, cmd->primCount, cmd->baseInstance);]]></programlisting> | |
83 | </para> | |
84 | <para> | |
85 | If a buffer is bound to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding at the time | |
86 | of a call to <function>glDrawArraysIndirect</function>, <parameter>indirect</parameter> | |
87 | is interpreted as an offset, in basic machine units, into that buffer and the parameter | |
88 | data is read from the buffer rather than from client memory. | |
89 | </para> | |
90 | <para> | |
91 | In contrast to <citerefentry><refentrytitle>glDrawArraysInstancedBaseInstance</refentrytitle></citerefentry>, | |
92 | the <code>first</code> member of the parameter structure is unsigned, and out-of-range indices | |
93 | do not generate an error. | |
94 | </para> | |
95 | <para> | |
96 | Vertex attributes that are modified by <function>glDrawArraysIndirect</function> have an | |
97 | unspecified value after <function>glDrawArraysIndirect</function> returns. Attributes that aren't | |
98 | modified remain well defined. | |
99 | </para> | |
100 | </refsect1> | |
101 | <refsect1 id="notes"><title>Notes</title> | |
102 | <para> | |
103 | The <parameter>baseInstance</parameter> member of the <parameter>DrawArraysIndirectCommand</parameter> | |
104 | structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2, | |
105 | this parameter is present but is reserved and should be set to zero. On earlier versions of the GL, | |
106 | behavior is undefined if it is non-zero. | |
107 | </para> | |
108 | </refsect1> | |
109 | <refsect1 id="errors"><title>Errors</title> | |
110 | <para> | |
111 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value. | |
112 | </para> | |
113 | <para> | |
114 | <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an | |
115 | enabled array or to the <constant>GL_DRAW_INDIRECT_BUFFER</constant> binding and the buffer object's data store is currently mapped. | |
116 | </para> | |
117 | <para> | |
118 | <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter> | |
119 | is incompatible with the input primitive type of the geometry shader in the currently installed program object. | |
120 | </para> | |
121 | <para> | |
122 | <constant>GL_INVALID_OPERATION</constant> is generated if <parameter>mode</parameter> is <constant>GL_PATCHES</constant> | |
123 | and no tessellation control shader is active. | |
124 | </para> | |
125 | </refsect1> | |
126 | <refsect1 id="seealso"><title>See Also</title> | |
127 | <para> | |
128 | <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>, | |
129 | <citerefentry><refentrytitle>glDrawArraysInstanced</refentrytitle></citerefentry>, | |
130 | <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>, | |
131 | <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>, | |
132 | </para> | |
133 | </refsect1> | |
134 | <refsect1 id="Copyright"><title>Copyright</title> | |
135 | <para> | |
136 | Copyright <trademark class="copyright"></trademark> 2010 Khronos Group. | |
137 | This material may be distributed subject to the terms and conditions set forth in | |
138 | the Open Publication License, v 1.0, 8 June 1999. | |
139 | <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>. | |
140 | </para> | |
141 | </refsect1> | |
142 | </refentry> |