GLVERTEXATTRIBFORMAT(3G)

NAME
glVertexAttribFormat, glVertexArrayAttribFormat - specify the organization of vertex arrays

C SPECIFICATION

void glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);

void glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);

void glVertexAttribLFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);

void glVertexArrayAttribFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);

void glVertexArrayAttribIFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);

void glVertexArrayAttribLFormat(GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);

PARAMETERS

vaobj
    Specifies the name of the vertex array object for glVertexArrayAttrib{I, L}Format functions.

attribindex
    The generic vertex attribute array being described.

size
    The number of values per vertex that are stored in the array.

type
    The type of the data stored in the array.

normalized
    Specifies whether fixed-point data values should be normalized (GL_TRUE) or converted directly as fixed-point values (GL_FALSE) when they are accessed. This parameter is ignored if type is GL_FIXED.

relativeoffset
    The distance between elements within the buffer.

DESCRIPTION

glVertexAttribFormat, glVertexAttribIFormat and glVertexAttribLFormat, as well as glVertexArrayAttribFormat, glVertexArrayAttribIFormat and glVertexArrayAttribLFormat specify the organization of data in vertex arrays. The first three calls operate on the bound vertex array object, whereas the last three ones modify the state of a vertex array object with ID vaobj. attribindex specifies the index of the generic vertex attribute array whose data layout is being described, and must be less than the value of GL_MAX_VERTEX_ATTRIBS.

size determines the number of components per vertex are allocated to the specified attribute and must be 1, 2, 3 or 4. type indicates the type of the data. If type is one of GL_BYTE, GL_SHORT, GL_INT, GL_FIXED, GL_FLOAT, GL_HALF_FLOAT, and GL_DOUBLE indicate types GLbyte, GLshort, GLint, GLfixed, GLfloat, GLhalf, and GLdouble, respectively; the values GL_UNSIGNED_BYTE, GL_UNSIGNED_SHORT, and GL_UNSIGNED_INT indicate types GLubyte, GLushort, and GLuint, respectively; the values GL_INT_2_10_10_10_REV and GL_UNSIGNED_INT_2_10_10_10_REV indicating respectively four signed or unsigned elements packed into a single GLuint; and the value GL_UNSIGNED_INT_10F_11F_11F_REV indicating three floating point values packed into a single GLuint.

glVertexAttribLFormat and glVertexArrayAttribLFormat is used to specify layout for data associated with a generic attribute variable declared as 64-bit double precision components. For glVertexAttribLFormat and glVertexArrayAttribLFormat, type must be GL_DOUBLE. In contrast to glVertexAttribFormat or glVertexArrayAttribFormat, which will cause data declared as GL_DOUBLE to be converted to 32-bit representation, glVertexAttribLFormat and glVertexArrayAttribLFormat cause such data to be left in its natural, 64-bit representation.

For glVertexAttribFormat and glVertexArrayAttribFormat, if normalized is GL_TRUE, then integer data is normalized to the range [-1, 1] or [0, 1] if it is signed or unsigned, respectively. If normalized is GL_FALSE then integer data is directly converted to floating point.

relativeoffset is the offset, measured in basic machine units of the first element relative to the start of the vertex buffer binding this attribute fetches from.

glVertexAttribFormat and glVertexArrayAttribFormat should be used to describe vertex attribute layout for floating-point vertex attributes, glVertexAttribIFormat and glVertexArrayAttribIFormat should be used to describe vertex attribute layout for integer vertex attribute, and glVertexAttribLFormat and glVertexArrayAttribLFormat should be used to describe the layout for 64-bit vertex attributes. Data for an array specified by glVertexAttribIFormat and glVertexArrayAttribIFormat will always be left as integer values; such data are referred to as pure integers.

NOTES

GL_UNSIGNED_INT_10F_11F_11F_REV is accepted for type only if the GL version is 4.4 or higher.

ERRORS

GL_INVALID_VALUE is generated if attribindex is greater than or equal to the value of GL_MAX_VERTEX_ATTRIBS.

GL_INVALID_VALUE is generated if size is not one of the accepted values.

GL_INVALID_VALUE is generated if relativeoffset is greater than the value of GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.

GL_INVALID_ENUM is generated if type is not one of the accepted tokens.

GL_INVALID_ENUM is generated by glVertexAttribIFormat, glVertexAttribLFormat, glVertexArrayAttribIFormat and glVertexArrayAttribLFormat if type is GL_UNSIGNED_INT_10F_11F_11F_REV.

GL_INVALID_OPERATION is generated by glVertexAttribFormat, glVertexAttribIFormat and glVertexAttribLFormat if no vertex array object is bound.

GL_INVALID_OPERATION is generated by glVertexArrayAttribFormat, glVertexArrayAttribIFormat and glVertexArrayAttribLFormat if vaobj is not the name of an existing vertex array object.

GL_INVALID_OPERATION is generated under any of the following conditions:

    • size is GL_BGRA and type is not GL_UNSIGNED_BYTE, GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV.

    • type is GL_INT_2_10_10_10_REV or GL_UNSIGNED_INT_2_10_10_10_REV, and size is neither 4 nor GL_BGRA.

    • type is GL_UNSIGNED_INT_10F_11F_11F_REV and size is not 3.

    • size is GL_BGRA and normalized is GL_FALSE.

ASSOCIATED GETS

glGet() with arguments GL_MAX_VERTEX_ATTRIB_BINDINGS, or GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.

glGetVertexAttrib() with argument GL_VERTEX_ATTRIB_RELATIVE_OFFSET.

VERSION SUPPORT
 | OpenGL Version
Function / Feature Name | 2.0 | 2.1 | 3.0 | 3.1 | 3.2 | 3.3 | 4.0 | 4.1 | 4.2 | 4.3 | 4.4 | 4.5
glVertexArrayAttribFormat | - | - | - | - | - | - | - | - | - | - | - | ✔
glVertexArrayAttribIFormat | - | - | - | - | - | - | - | - | - | - | - | ✔
glVertexArrayAttribLFormat | - | - | - | - | - | - | - | - | - | - | - | ✔
glVertexAttribFormat | - | - | - | - | - | - | - | - | - | ✔ | ✔ | ✔
glVertexAttribIFormat | - | - | - | - | - | - | - | - | - | ✔ | ✔ | ✔
glVertexAttribLFormat | - | - | - | - | - | - | - | - | - | ✔ | ✔ | ✔

SEE ALSO

glBindVertexBuffer(), glVertexAttribBinding(), glVertexAttribPointer(), glVertexBindingDivisor(), glVertexAttribPointer().

COPYRIGHT

Copyright © 2013-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.

COPYRIGHT
Copyright © 2013-2014 Khronos Group