| 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="glDrawElements"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glDrawElements</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glDrawElements</refname> |
| 17 | <refpurpose>render primitives from array data</refpurpose> |
| 18 | </refnamediv> |
| 19 | <refsynopsisdiv><title>C Specification</title> |
| 20 | <funcsynopsis> |
| 21 | <funcprototype> |
| 22 | <funcdef>void <function>glDrawElements</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 GLvoid * <parameter>indices</parameter></paramdef> |
| 27 | </funcprototype> |
| 28 | </funcsynopsis> |
| 29 | </refsynopsisdiv> |
| 30 | <!-- eqn: ignoring delim $$ --> |
| 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 |
| 67 | <constant>GL_UNSIGNED_BYTE</constant>, <constant>GL_UNSIGNED_SHORT</constant>, or |
| 68 | <constant>GL_UNSIGNED_INT</constant>. |
| 69 | </para> |
| 70 | </listitem> |
| 71 | </varlistentry> |
| 72 | <varlistentry> |
| 73 | <term><parameter>indices</parameter></term> |
| 74 | <listitem> |
| 75 | <para> |
| 76 | Specifies a pointer to the location where the indices are stored. |
| 77 | </para> |
| 78 | </listitem> |
| 79 | </varlistentry> |
| 80 | </variablelist> |
| 81 | </refsect1> |
| 82 | <refsect1 id="description"><title>Description</title> |
| 83 | <para> |
| 84 | <function>glDrawElements</function> specifies multiple geometric primitives |
| 85 | with very few subroutine calls. Instead of calling a GL function |
| 86 | to pass each individual vertex, normal, texture coordinate, edge |
| 87 | flag, or color, you can prespecify |
| 88 | separate arrays of vertices, normals, and so on, and use them to |
| 89 | construct a sequence of primitives with a single |
| 90 | call to <function>glDrawElements</function>. |
| 91 | </para> |
| 92 | <para> |
| 93 | When <function>glDrawElements</function> is called, it uses <parameter>count</parameter> sequential elements from an |
| 94 | enabled array, starting at <parameter>indices</parameter> to construct a sequence of |
| 95 | geometric primitives. <parameter>mode</parameter> specifies what kind of primitives are |
| 96 | constructed and how the array elements construct these primitives. If |
| 97 | more than one array is enabled, each is used. |
| 98 | </para> |
| 99 | <para> |
| 100 | Vertex attributes that are modified by <function>glDrawElements</function> have an |
| 101 | unspecified value after <function>glDrawElements</function> returns. Attributes that aren't |
| 102 | modified maintain their previous values. |
| 103 | </para> |
| 104 | </refsect1> |
| 105 | <refsect1 id="notes"><title>Notes</title> |
| 106 | <para> |
| 107 | <constant>GL_LINE_STRIP_ADJACENCY</constant>, |
| 108 | <constant>GL_LINES_ADJACENCY</constant>, |
| 109 | <constant>GL_TRIANGLE_STRIP_ADJACENCY</constant> and |
| 110 | <constant>GL_TRIANGLES_ADJACENCY</constant> |
| 111 | are available only if the GL version is 3.2 or greater. |
| 112 | </para> |
| 113 | </refsect1> |
| 114 | <refsect1 id="errors"><title>Errors</title> |
| 115 | <para> |
| 116 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value. |
| 117 | </para> |
| 118 | <para> |
| 119 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>count</parameter> is negative. |
| 120 | </para> |
| 121 | <para> |
| 122 | <constant>GL_INVALID_OPERATION</constant> is generated if a geometry shader is active and <parameter>mode</parameter> |
| 123 | is incompatible with the input primitive type of the geometry shader in the currently installed program object. |
| 124 | </para> |
| 125 | <para> |
| 126 | <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an |
| 127 | enabled array or the element array and the buffer object's data store is currently mapped. |
| 128 | </para> |
| 129 | </refsect1> |
| 130 | <refsect1 id="seealso"><title>See Also</title> |
| 131 | <para> |
| 132 | <citerefentry><refentrytitle>glDrawArrays</refentrytitle></citerefentry>, |
| 133 | <citerefentry><refentrytitle>glDrawElementsInstanced</refentrytitle></citerefentry>, |
| 134 | <citerefentry><refentrytitle>glDrawElementsBaseVertex</refentrytitle></citerefentry>, |
| 135 | <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry> |
| 136 | </para> |
| 137 | </refsect1> |
| 138 | <refsect1 id="Copyright"><title>Copyright</title> |
| 139 | <para> |
| 140 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 141 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 142 | Free Software B License. For details, see |
| 143 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 144 | </para> |
| 145 | </refsect1> |
| 146 | </refentry> |