1908d4bac54ef8bc07e1914b8e9c3c9487b8fb86
[clinton/guile-figl.git] / upstream-man-pages / man3 / glDrawElementsInstanced.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="glDrawElementsInstanced">
5 <refmeta>
6 <refmetainfo>
7 <copyright>
8 <year>2010</year>
9 <holder>Khronos Group</holder>
10 </copyright>
11 </refmetainfo>
12 <refentrytitle>glDrawElementsInstanced</refentrytitle>
13 <manvolnum>3G</manvolnum>
14 </refmeta>
15 <refnamediv>
16 <refname>glDrawElementsInstanced</refname>
17 <refpurpose>draw multiple instances of a set of elements</refpurpose>
18 </refnamediv>
19 <refsynopsisdiv><title>C Specification</title>
20 <funcsynopsis>
21 <funcprototype>
22 <funcdef>void <function>glDrawElementsInstanced</function></funcdef>
23 <paramdef>GLenum <parameter>mode</parameter></paramdef>
24 <paramdef>GLsizei <parameter>count</parameter></paramdef>
25 <paramdef>GLenum <parameter>type</parameter></paramdef>
26 <paramdef>const void * <parameter>indices</parameter></paramdef>
27 <paramdef>GLsizei <parameter>primcount</parameter></paramdef>
28 </funcprototype>
29 </funcsynopsis>
30 </refsynopsisdiv>
31 <refsect1 id="parameters"><title>Parameters</title>
32 <variablelist>
33 <varlistentry>
34 <term><parameter>mode</parameter></term>
35 <listitem>
36 <para>
37 Specifies what kind of primitives to render.
38 Symbolic constants
39 <constant>GL_POINTS</constant>,
40 <constant>GL_LINE_STRIP</constant>,
41 <constant>GL_LINE_LOOP</constant>,
42 <constant>GL_LINES</constant>,
43 <constant>GL_LINE_STRIP_ADJACENCY</constant>,
44 <constant>GL_LINES_ADJACENCY</constant>,
45 <constant>GL_TRIANGLE_STRIP</constant>,
46 <constant>GL_TRIANGLE_FAN</constant>,
47 <constant>GL_TRIANGLES</constant>,
48 <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant> and
49 <constant>GL_TRIANGLES_ADJACENCY</constant>
50 are accepted.
51 </para>
52 </listitem>
53 </varlistentry>
54 <varlistentry>
55 <term><parameter>count</parameter></term>
56 <listitem>
57 <para>
58 Specifies the number of elements to be rendered.
59 </para>
60 </listitem>
61 </varlistentry>
62 <varlistentry>
63 <term><parameter>type</parameter></term>
64 <listitem>
65 <para>
66 Specifies the type of the values in <parameter>indices</parameter>. Must be one of <constant>GL_UNSIGNED_BYTE</constant>,
67 <constant>GL_UNSIGNED_SHORT</constant>, or <constant>GL_UNSIGNED_INT</constant>.
68 </para>
69 </listitem>
70 </varlistentry>
71 <varlistentry>
72 <term><parameter>indices</parameter></term>
73 <listitem>
74 <para>
75 Specifies a pointer to the location where the indices are stored.
76 </para>
77 </listitem>
78 </varlistentry>
79 <varlistentry>
80 <term><parameter>primcount</parameter></term>
81 <listitem>
82 <para>
83 Specifies the number of instances of the specified range of indices to be rendered.
84 </para>
85 </listitem>
86 </varlistentry>
87 </variablelist>
88 </refsect1>
89 <refsect1 id="description"><title>Description</title>
90 <para>
91 <function>glDrawElementsInstanced</function> behaves identically to <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>
92 except that <parameter>primcount</parameter> instances of the set of elements are executed and the value of the internal counter
93 <parameter>instanceID</parameter> advances for each iteration. <parameter>instanceID</parameter> is an internal 32-bit integer counter
94 that may be read by a vertex shader as <constant>gl_InstanceID</constant>.
95 </para>
96 <para>
97 <function>glDrawElementsInstanced</function> has the same effect as:
98 <programlisting><![CDATA[ if (mode, count, or type is invalid )
99 generate appropriate error
100 else {
101 for (int i = 0; i < primcount ; i++) {
102 instanceID = i;
103 glDrawElements(mode, count, type, indices);
104 }
105 instanceID = 0;
106 }]]></programlisting>
107 </para>
108 </refsect1>
109 <refsect1 id="notes"><title>Notes</title>
110 <para>
111 <function>glDrawElementsInstanced</function> is available only if the GL version is 3.1 or greater.
112 </para>
113 <para>
114 <constant>GL_LINE_STRIP_ADJACENCY</constant>,
115 <constant>GL_LINES_ADJACENCY</constant>,
116 <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant> and
117 <constant>GL_TRIANGLES_ADJACENCY</constant>
118 are available only if the GL version is 3.2 or greater.
119 </para>
120 </refsect1>
121 <refsect1 id="errors"><title>Errors</title>
122 <para>
123 <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not one of <constant>GL_POINTS</constant>,
124 <constant>GL_LINE_STRIP</constant>, <constant>GL_LINE_LOOP</constant>, <constant>GL_LINES</constant>,
125 <constant>GL_TRIANGLE_STRIP</constant>, <constant>GL_TRIANGLE_FAN</constant>, or <constant>GL_TRIANGLES</constant>.
126 </para>
127 <para>
128 <constant>GL_INVALID_VALUE</constant> is generated if <parameter>count</parameter> or <parameter>primcount</parameter> are negative.
129 </para>
130 <para>
131 <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter>
132 is incompatible with the input primitive type of the geometry shader in the currently installed program object.
133 </para>
134 <para>
135 <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an
136 enabled array and the buffer object's data store is currently mapped.
137 </para>
138 </refsect1>
139 <refsect1 id="seealso"><title>See Also</title>
140 <para>
141 <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>,
142 <citerefentry><refentrytitle>glDrawArraysInstanced</refentrytitle></citerefentry>
143 </para>
144 </refsect1>
145 <refsect1 id="Copyright"><title>Copyright</title>
146 <para>
147 Copyright <trademark class="copyright"></trademark> 2010 Khronos Group.
148 This material may be distributed subject to the terms and conditions set forth in
149 the Open Publication License, v 1.0, 8 June 1999.
150 <ulink url="http://opencontent.org/openpub/">http://opencontent.org/openpub/</ulink>.
151 </para>
152 </refsect1>
153 </refentry>