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