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