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=
"glVertexAttribPointer">
6 <refentrytitle>glVertexAttribPointer
</refentrytitle>
7 <manvolnum>3G
</manvolnum>
10 <refname>glVertexAttribPointer
</refname>
11 <refpurpose>define an array of generic vertex attribute data
</refpurpose>
13 <refsynopsisdiv><title>C Specification
</title>
16 <funcdef>void
<function>glVertexAttribPointer
</function></funcdef>
17 <paramdef>GLuint
<parameter>index
</parameter></paramdef>
18 <paramdef>GLint
<parameter>size
</parameter></paramdef>
19 <paramdef>GLenum
<parameter>type
</parameter></paramdef>
20 <paramdef>GLboolean
<parameter>normalized
</parameter></paramdef>
21 <paramdef>GLsizei
<parameter>stride
</parameter></paramdef>
22 <paramdef>const GLvoid *
<parameter>pointer
</parameter></paramdef>
25 <funcdef>void
<function>glVertexAttribIPointer
</function></funcdef>
26 <paramdef>GLuint
<parameter>index
</parameter></paramdef>
27 <paramdef>GLint
<parameter>size
</parameter></paramdef>
28 <paramdef>GLenum
<parameter>type
</parameter></paramdef>
29 <paramdef>GLsizei
<parameter>stride
</parameter></paramdef>
30 <paramdef>const GLvoid *
<parameter>pointer
</parameter></paramdef>
34 <refsect1 id=
"parameters"><title>Parameters
</title>
37 <term><parameter>index
</parameter></term>
39 <para>Specifies the index of the generic vertex
40 attribute to be modified.
</para>
44 <term><parameter>size
</parameter></term>
46 <para>Specifies the number of components per
47 generic vertex attribute. Must
48 be
1,
2,
3,
4. Additionally, the symbolic constant
<constant>GL_BGRA
</constant>
49 is accepted by
<function>glVertexAttribPointer
</function>. The initial value is
4.
</para>
53 <term><parameter>type
</parameter></term>
55 <para>Specifies the data type of each component in
56 the array. The symbolic constants
57 <constant>GL_BYTE
</constant>,
58 <constant>GL_UNSIGNED_BYTE
</constant>,
59 <constant>GL_SHORT
</constant>,
60 <constant>GL_UNSIGNED_SHORT
</constant>,
61 <constant>GL_INT
</constant>, and
62 <constant>GL_UNSIGNED_INT
</constant> are accepted by both functions. Additionally
63 <constant>GL_HALF_FLOAT
</constant>,
64 <constant>GL_FLOAT
</constant>,
65 <constant>GL_DOUBLE
</constant>,
66 <constant>GL_INT_2_10_10_10_REV
</constant>, and
67 <constant>GL_UNSIGNED_INT_2_10_10_10_REV
</constant> are accepted by
<function>glVertexAttribPointer
</function>.
68 The initial value is
<constant>GL_FLOAT
</constant>.
</para>
72 <term><parameter>normalized
</parameter></term>
74 <para>For
<function>glVertexAttribPointer
</function>, specifies whether fixed-point data values
75 should be normalized (
<constant>GL_TRUE
</constant>)
76 or converted directly as fixed-point values
77 (
<constant>GL_FALSE
</constant>) when they are
82 <term><parameter>stride
</parameter></term>
84 <para>Specifies the byte offset between consecutive
85 generic vertex attributes. If
<parameter>stride
</parameter>
86 is
0, the generic vertex attributes are
87 understood to be tightly packed in the
88 array. The initial value is
0.
</para>
92 <term><parameter>pointer
</parameter></term>
94 <para>Specifies a offset of the first component of the first generic vertex attribute in the array in the data store of the
95 buffer currently bound to the
<constant>GL_ARRAY_BUFFER
</constant> target. The initial value is
0.
</para>
100 <refsect1 id=
"description"><title>Description
</title>
102 <function>glVertexAttribPointer
</function> and
<function>glVertexAttribIPointer
</function> specify the
103 location and data format of the array of generic vertex attributes at index
<parameter>index
</parameter>
104 to use when rendering.
<parameter>size
</parameter> specifies the number of components per attribute and
105 must be
1,
2,
3,
4, or
<constant>GL_BGRA
</constant>.
<parameter>type
</parameter> specifies the data type
106 of each component, and
<parameter>stride
</parameter> specifies the byte stride from one attribute to the next,
107 allowing vertices and attributes to be packed into a single array or stored in separate arrays.
110 For
<function>glVertexAttribPointer
</function>, if
<parameter>normalized
</parameter> is set to
<constant>GL_TRUE
</constant>,
111 it indicates that values stored in an integer format are to be mapped to the range [-
1,
1] (for signed values) or [
0,
1] (for
112 unsigned values) when they are accessed and converted to floating point. Otherwise, values will
113 be converted to floats directly without normalization.
116 For
<function>glVertexAttribIPointer
</function>, only the integer types
<constant>GL_BYTE
</constant>,
117 <constant>GL_UNSIGNED_BYTE
</constant>,
<constant>GL_SHORT
</constant>,
<constant>GL_UNSIGNED_SHORT
</constant>,
118 <constant>GL_INT
</constant>,
<constant>GL_UNSIGNED_INT
</constant> are accepted. Values are always left as integer values.
121 If
<parameter>pointer
</parameter> is not
<code>NULL
</code>, a non-zero named buffer object must be bound to the
122 <constant>GL_ARRAY_BUFFER
</constant> target (see
<citerefentry><refentrytitle>glBindBuffer
</refentrytitle></citerefentry>),
123 otherwise an error is generated.
<parameter>pointer
</parameter> is treated as a byte offset into the buffer object's data store.
124 The buffer object binding (
<constant>GL_ARRAY_BUFFER_BINDING
</constant>) is saved as generic vertex attribute array
125 state (
<constant>GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
</constant>) for index
<parameter>index
</parameter>.
128 When a generic vertex attribute array is specified,
129 <parameter>size
</parameter>,
<parameter>type
</parameter>,
130 <parameter>normalized
</parameter>,
131 <parameter>stride
</parameter>, and
132 <parameter>pointer
</parameter> are saved as vertex array
133 state, in addition to the current vertex array buffer object binding.
137 To enable and disable a generic vertex attribute array, call
138 <citerefentry><refentrytitle>glEnableVertexAttribArray
</refentrytitle></citerefentry> and
139 <citerefentry><refentrytitle>glDisableVertexAttribArray
</refentrytitle></citerefentry> with
<parameter>index
</parameter>.
140 If enabled, the generic vertex attribute array is used when
<citerefentry><refentrytitle>glDrawArrays
</refentrytitle></citerefentry>,
141 <citerefentry><refentrytitle>glMultiDrawArrays
</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glDrawElements
</refentrytitle></citerefentry>,
142 <citerefentry><refentrytitle>glMultiDrawElements
</refentrytitle></citerefentry>, or
<citerefentry><refentrytitle>glDrawRangeElements
</refentrytitle></citerefentry>
146 <refsect1 id=
"notes"><title>Notes
</title>
148 Each generic vertex attribute array is initially disabled and isn't accessed when
149 <citerefentry><refentrytitle>glDrawElements
</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glDrawRangeElements
</refentrytitle></citerefentry>,
150 <citerefentry><refentrytitle>glDrawArrays
</refentrytitle></citerefentry>,
<citerefentry><refentrytitle>glMultiDrawArrays
</refentrytitle></citerefentry>, or
<citerefentry><refentrytitle>glMultiDrawElements
</refentrytitle></citerefentry>
154 <function>glVertexAttribIPointer
</function> is available only if the GL version is
3.0 or higher.
158 <refsect1 id=
"errors"><title>Errors
</title>
159 <para><constant>GL_INVALID_VALUE
</constant> is generated if
160 <parameter>index
</parameter> is greater than or equal to
161 <constant>GL_MAX_VERTEX_ATTRIBS
</constant>.
</para>
163 <para><constant>GL_INVALID_VALUE
</constant> is generated if
164 <parameter>size
</parameter> is not
1,
2,
3,
4 or (for
<function>glVertexAttribPointer
</function>),
165 <constant>GL_BGRA
</constant>.
</para>
167 <para><constant>GL_INVALID_ENUM
</constant> is generated if
168 <parameter>type
</parameter> is not an accepted value.
</para>
170 <para><constant>GL_INVALID_VALUE
</constant> is generated if
171 <parameter>stride
</parameter> is negative.
</para>
173 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
<parameter>size
</parameter>
174 is
<constant>GL_BGRA
</constant> and
<parameter>type
</parameter> is not
<constant>GL_UNSIGNED_BYTE
</constant>,
175 <constant>GL_INT_2_10_10_10_REV
</constant> or
<constant>GL_UNSIGNED_INT_2_10_10_10_REV
</constant>.
</para>
177 <para><constant>GL_INVALID_OPERATION
</constant> is generated if
<parameter>type
</parameter>
178 is
<constant>GL_INT_2_10_10_10_REV
</constant> or
<constant>GL_UNSIGNED_INT_2_10_10_10_REV
</constant>
179 and
<parameter>size
</parameter> is not
4 or
<constant>GL_BGRA
</constant>.
</para>
181 <para><constant>GL_INVALID_OPERATION
</constant> is generated by
<function>glVertexAttribPointer
</function>
182 if
<parameter>size
</parameter> is
<constant>GL_BGRA
</constant> and
<parameter>noramlized
</parameter>
183 is
<constant>GL_FALSE
</constant>.
</para>
185 <para><constant>GL_INVALID_OPERATION
</constant> is generated if zero is bound to the
186 <constant>GL_ARRAY_BUFFER
</constant> buffer object binding point and the
187 <parameter>pointer
</parameter> argument is not
<constant>NULL
</constant>.
</para>
189 <refsect1 id=
"associatedgets"><title>Associated Gets
</title>
190 <para><citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry>
191 with argument
<constant>GL_MAX_VERTEX_ATTRIBS
</constant></para>
193 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
194 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_ENABLED
</constant></para>
196 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
197 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_SIZE
</constant></para>
199 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
200 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_TYPE
</constant></para>
202 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
203 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
</constant></para>
205 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
206 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_STRIDE
</constant></para>
208 <para><citerefentry><refentrytitle>glGetVertexAttrib
</refentrytitle></citerefentry>
209 with arguments
<parameter>index
</parameter> and
<constant>GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
</constant></para>
211 <para><citerefentry><refentrytitle>glGet
</refentrytitle></citerefentry> with argument
212 <constant>GL_ARRAY_BUFFER_BINDING
</constant></para>
214 <para><citerefentry><refentrytitle>glGetVertexAttribPointerv
</refentrytitle></citerefentry>
215 with arguments
<parameter>index
</parameter> and
216 <constant>GL_VERTEX_ATTRIB_ARRAY_POINTER
</constant></para>
218 <refsect1 id=
"seealso"><title>See Also
</title>
220 <citerefentry><refentrytitle>glBindAttribLocation
</refentrytitle></citerefentry>,
221 <citerefentry><refentrytitle>glBindBuffer
</refentrytitle></citerefentry>,
222 <citerefentry><refentrytitle>glDisableVertexAttribArray
</refentrytitle></citerefentry>,
223 <citerefentry><refentrytitle>glDrawArrays
</refentrytitle></citerefentry>,
224 <citerefentry><refentrytitle>glDrawElements
</refentrytitle></citerefentry>,
225 <citerefentry><refentrytitle>glDrawRangeElements
</refentrytitle></citerefentry>,
226 <citerefentry><refentrytitle>glEnableVertexAttribArray
</refentrytitle></citerefentry>,
227 <citerefentry><refentrytitle>glMultiDrawArrays
</refentrytitle></citerefentry>,
228 <citerefentry><refentrytitle>glMultiDrawElements
</refentrytitle></citerefentry>,
229 <citerefentry><refentrytitle>glVertexAttrib
</refentrytitle></citerefentry>
232 <refsect1 id=
"Copyright"><title>Copyright
</title>
234 Copyright
<trademark class=
"copyright"></trademark> 2003-
2005 3Dlabs Inc. Ltd.
235 This material may be distributed subject to the terms and conditions set forth in
236 the Open Publication License, v
1.0,
8 June
1999.
237 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.