| 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="glDrawArrays"> |
| 5 | <refmeta> |
| 6 | <refmetainfo> |
| 7 | <copyright> |
| 8 | <year>1991-2006</year> |
| 9 | <holder>Silicon Graphics, Inc.</holder> |
| 10 | </copyright> |
| 11 | </refmetainfo> |
| 12 | <refentrytitle>glDrawArrays</refentrytitle> |
| 13 | <manvolnum>3G</manvolnum> |
| 14 | </refmeta> |
| 15 | <refnamediv> |
| 16 | <refname>glDrawArrays</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>glDrawArrays</function></funcdef> |
| 23 | <paramdef>GLenum <parameter>mode</parameter></paramdef> |
| 24 | <paramdef>GLint <parameter>first</parameter></paramdef> |
| 25 | <paramdef>GLsizei <parameter>count</parameter></paramdef> |
| 26 | </funcprototype> |
| 27 | </funcsynopsis> |
| 28 | </refsynopsisdiv> |
| 29 | <!-- eqn: ignoring delim $$ --> |
| 30 | <refsect1 id="parameters"><title>Parameters</title> |
| 31 | <variablelist> |
| 32 | <varlistentry> |
| 33 | <term><parameter>mode</parameter></term> |
| 34 | <listitem> |
| 35 | <para> |
| 36 | Specifies what kind of primitives to render. |
| 37 | Symbolic constants |
| 38 | <constant>GL_POINTS</constant>, |
| 39 | <constant>GL_LINE_STRIP</constant>, |
| 40 | <constant>GL_LINE_LOOP</constant>, |
| 41 | <constant>GL_LINES</constant>, |
| 42 | <constant>GL_TRIANGLE_STRIP</constant>, |
| 43 | <constant>GL_TRIANGLE_FAN</constant>, |
| 44 | <constant>GL_TRIANGLES</constant>, |
| 45 | <constant>GL_QUAD_STRIP</constant>, |
| 46 | <constant>GL_QUADS</constant>, |
| 47 | and <constant>GL_POLYGON</constant> are accepted. |
| 48 | </para> |
| 49 | </listitem> |
| 50 | </varlistentry> |
| 51 | <varlistentry> |
| 52 | <term><parameter>first</parameter></term> |
| 53 | <listitem> |
| 54 | <para> |
| 55 | Specifies the starting index in the enabled arrays. |
| 56 | </para> |
| 57 | </listitem> |
| 58 | </varlistentry> |
| 59 | <varlistentry> |
| 60 | <term><parameter>count</parameter></term> |
| 61 | <listitem> |
| 62 | <para> |
| 63 | Specifies the number of indices to be rendered. |
| 64 | </para> |
| 65 | </listitem> |
| 66 | </varlistentry> |
| 67 | </variablelist> |
| 68 | </refsect1> |
| 69 | <refsect1 id="description"><title>Description</title> |
| 70 | <para> |
| 71 | <function>glDrawArrays</function> specifies multiple geometric primitives |
| 72 | with very few subroutine calls. Instead of calling a GL procedure |
| 73 | to pass each individual vertex, normal, texture coordinate, edge |
| 74 | flag, or color, you can prespecify |
| 75 | separate arrays of vertices, normals, and colors and use them to |
| 76 | construct a sequence of primitives with a single |
| 77 | call to <function>glDrawArrays</function>. |
| 78 | </para> |
| 79 | <para> |
| 80 | When <function>glDrawArrays</function> is called, it uses <parameter>count</parameter> sequential elements from each |
| 81 | enabled array to construct a sequence of geometric primitives, |
| 82 | beginning with element <parameter>first</parameter>. <parameter>mode</parameter> specifies what kind of |
| 83 | primitives are constructed and how the array elements |
| 84 | construct those primitives. If <constant>GL_VERTEX_ARRAY</constant> is not enabled, no |
| 85 | geometric primitives are generated. |
| 86 | </para> |
| 87 | <para> |
| 88 | Vertex attributes that are modified by <function>glDrawArrays</function> have an |
| 89 | unspecified value after <function>glDrawArrays</function> returns. For example, if |
| 90 | <constant>GL_COLOR_ARRAY</constant> is enabled, the value of the current color is |
| 91 | undefined after <function>glDrawArrays</function> executes. Attributes that aren't |
| 92 | modified remain well defined. |
| 93 | </para> |
| 94 | </refsect1> |
| 95 | <refsect1 id="notes"><title>Notes</title> |
| 96 | <para> |
| 97 | <function>glDrawArrays</function> is available only if the GL version is 1.1 or greater. |
| 98 | </para> |
| 99 | <para> |
| 100 | <function>glDrawArrays</function> is included in display lists. If <function>glDrawArrays</function> is entered into a |
| 101 | display list, |
| 102 | the necessary array data (determined by the array pointers and |
| 103 | enables) is also |
| 104 | entered into the display list. Because the array pointers and |
| 105 | enables are client-side state, their values affect display lists |
| 106 | when the lists are created, not when the lists are executed. |
| 107 | </para> |
| 108 | </refsect1> |
| 109 | <refsect1 id="errors"><title>Errors</title> |
| 110 | <para> |
| 111 | <constant>GL_INVALID_ENUM</constant> is generated if <parameter>mode</parameter> is not an accepted value. |
| 112 | </para> |
| 113 | <para> |
| 114 | <constant>GL_INVALID_VALUE</constant> is generated if <parameter>count</parameter> is negative. |
| 115 | </para> |
| 116 | <para> |
| 117 | <constant>GL_INVALID_OPERATION</constant> is generated if a non-zero buffer object name is bound to an |
| 118 | enabled array and the buffer object's data store is currently mapped. |
| 119 | </para> |
| 120 | <para> |
| 121 | <constant>GL_INVALID_OPERATION</constant> is generated if <function>glDrawArrays</function> is executed between |
| 122 | the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>. |
| 123 | </para> |
| 124 | </refsect1> |
| 125 | <refsect1 id="seealso"><title>See Also</title> |
| 126 | <para> |
| 127 | <citerefentry><refentrytitle>glArrayElement</refentrytitle></citerefentry>, |
| 128 | <citerefentry><refentrytitle>glColorPointer</refentrytitle></citerefentry>, |
| 129 | <citerefentry><refentrytitle>glDrawElements</refentrytitle></citerefentry>, |
| 130 | <citerefentry><refentrytitle>glDrawRangeElements</refentrytitle></citerefentry>, |
| 131 | <citerefentry><refentrytitle>glEdgeFlagPointer</refentrytitle></citerefentry>, |
| 132 | <citerefentry><refentrytitle>glFogCoordPointer</refentrytitle></citerefentry>, |
| 133 | <citerefentry><refentrytitle>glGetPointerv</refentrytitle></citerefentry>, |
| 134 | <citerefentry><refentrytitle>glIndexPointer</refentrytitle></citerefentry>, |
| 135 | <citerefentry><refentrytitle>glInterleavedArrays</refentrytitle></citerefentry>, |
| 136 | <citerefentry><refentrytitle>glNormalPointer</refentrytitle></citerefentry>, |
| 137 | <citerefentry><refentrytitle>glSecondaryColorPointer</refentrytitle></citerefentry>, |
| 138 | <citerefentry><refentrytitle>glTexCoordPointer</refentrytitle></citerefentry>, |
| 139 | <citerefentry><refentrytitle>glVertexPointer</refentrytitle></citerefentry> |
| 140 | </para> |
| 141 | </refsect1> |
| 142 | <refsect1 id="Copyright"><title>Copyright</title> |
| 143 | <para> |
| 144 | Copyright <trademark class="copyright"></trademark> 1991-2006 |
| 145 | Silicon Graphics, Inc. This document is licensed under the SGI |
| 146 | Free Software B License. For details, see |
| 147 | <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>. |
| 148 | </para> |
| 149 | </refsect1> |
| 150 | </refentry> |