88baff2556a7e5c6f6c3da0c0d286a1bd4b16932
[clinton/guile-figl.git] / upstream-man-pages / man4 / xhtml / glDrawArraysIndirect.xml
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>glDrawArraysIndirect - 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="glDrawArraysIndirect"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glDrawArraysIndirect — render 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">glDrawArraysIndirect</b>(</code></td><td>GLenum  </td><td><var class="pdparam">mode</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>indirect</code></em></span></dt><dd><p>
21 Specifies the address of a structure containing the draw parameters.
22 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
23 <code class="function">glDrawArraysIndirect</code> specifies multiple geometric primitives
24 with very few subroutine calls. <code class="function">glDrawArraysIndirect</code> behaves
25 similarly to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a>,
26 execept that the parameters to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a>
27 are stored in memory at the address given by <em class="parameter"><code>indirect</code></em>.
28 </p><p>
29 The parameters addressed by <em class="parameter"><code>indirect</code></em> are packed into a structure
30 that takes the form (in C):
31 </p><pre class="programlisting"> typedef struct {
32 uint count;
33 uint primCount;
34 uint first;
35 uint baseInstance;
36 } DrawArraysIndirectCommand;
37
38 const DrawArraysIndirectCommand *cmd = (const DrawArraysIndirectCommand *)indirect;
39 glDrawArraysInstancedBaseInstance(mode, cmd-&gt;first, cmd-&gt;count, cmd-&gt;primCount, cmd-&gt;baseInstance);</pre><p>
40 </p><p>
41 If a buffer is bound to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding at the time
42 of a call to <code class="function">glDrawArraysIndirect</code>, <em class="parameter"><code>indirect</code></em>
43 is interpreted as an offset, in basic machine units, into that buffer and the parameter
44 data is read from the buffer rather than from client memory.
45 </p><p>
46 In contrast to <a href="glDrawArraysInstancedBaseInstance.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstancedBaseInstance</span></span></a>,
47 the <code class="code">first</code> member of the parameter structure is unsigned, and out-of-range indices
48 do not generate an error.
49 </p><p>
50 Vertex attributes that are modified by <code class="function">glDrawArraysIndirect</code> have an
51 unspecified value after <code class="function">glDrawArraysIndirect</code> returns. Attributes that aren't
52 modified remain well defined.
53 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
54 The <em class="parameter"><code>baseInstance</code></em> member of the <em class="parameter"><code>DrawArraysIndirectCommand</code></em>
55 structure is defined only if the GL version is 4.2 or greater. For versions of the GL less than 4.2,
56 this parameter is present but is reserved and should be set to zero. On earlier versions of the GL,
57 behavior is undefined if it is non-zero.
58 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
59 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>mode</code></em> is not an accepted value.
60 </p><p>
61 <code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to an
62 enabled array or to the <code class="constant">GL_DRAW_INDIRECT_BUFFER</code> binding and the buffer object's data store is currently mapped.
63 </p><p>
64 <code class="constant">GL_INVALID_OPERATION</code> is generated if a geometry shader is active and <em class="parameter"><code>mode</code></em>
65 is incompatible with the input primitive type of the geometry shader in the currently installed program object.
66 </p><p>
67 <code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>mode</code></em> is <code class="constant">GL_PATCHES</code>
68 and no tessellation control shader is active.
69 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
70 <a href="glDrawArrays.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArrays</span></span></a>,
71 <a href="glDrawArraysInstanced.xml"><span class="citerefentry"><span class="refentrytitle">glDrawArraysInstanced</span></span></a>,
72 <a href="glDrawElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawElements</span></span></a>,
73 <a href="glDrawRangeElements.xml"><span class="citerefentry"><span class="refentrytitle">glDrawRangeElements</span></span></a>,
74 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
75 Copyright <span class="trademark"></span>© 2010 Khronos Group.
76 This material may be distributed subject to the terms and conditions set forth in
77 the Open Publication License, v 1.0, 8 June 1999.
78 <a href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
79 </p></div></div></body></html>