glVertexAttribPointer Function

Syntax

GL_APICALL void GL_APIENTRY glVertexAttribPointer(
     GLuint index,
     GLint size,
     GLenum type,
     GLboolean normalized,
     GLsizei stride,
     const void * ptr
);

Arguments

Name Description
in index Vertex attribute index number
in size Number of vertex elements
in type Vertex data type
in normalized Whether to normalize values
in stride Number of bytes in the stride
in ptr Pointer to vertex data (when vertex buffer object 0 is bound)

Return Values

No values are returned.

Description

Configures a vertex attribute array.

Set index to a value that is greater than or equal to 0 and at least one less than the value that can be obtained by glGetIntegerv with GL_MAX_VERTEX_ATTRIBS specified.

Set size to the number of components: either 1, 2, 3, or 4.

Set type to the data type: GL_FLOAT, GL_SHORT, GL_BYTE, or GL_UNSIGNED_BYTE. You cannot specify GL_UNSIGNED_SHORT or GL_FIXED from the OpenGL ES 2.0 standard.

You must specify GL_FALSE for the normalized argument.

When vertex buffer objects are not in use, set ptr to a pointer to vertex data. When vertex buffer objects are in use, set ptr to the offset of the region to start using within the vertex data currently bound to GL_ARRAY_BUFFER. You must set ptr to an address or offset value that is aligned to the type specified by type.

Set stride to the byte offset between consecutive vertex data. When 0 is specified, vertex data is handled as if there are no gaps between it.

This function generates the following errors.

GL_INVALID_VALUEThe index or size argument was set to an invalid value.
GL_INVALID_VALUEThe stride argument was set to a negative value.
GL_INVALID_ENUMThe type argument was set to an invalid value.
GL_INVALID_OPERATIONThe normalized argument was set to an invalid value.

Revision History

2010/08/11
Revised description for the normalized argument.
2010/01/07
Initial version.

CONFIDENTIAL