GLVERTEXATTRIBFORMAT(3G)
okay bestie, welcome to the GLVERTEXATTRIBFORMAT(3G) page β yes, the manual name is literally in the intro because we're doing this cute. Grab your iced coffee, we're about to describe vertex array layouts and make it make sense.
πΈ 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β the name of the vertex array object for theglVertexArrayAttrib{I, L}Formatfunctions. yes, that exact curly-brace notation, she's iconic.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β whether fixed-point data values should be normalized (GL_TRUE) or converted directly as fixed-point values (GL_FALSE) when they're accessed. this parameter is ignored iftypeisGL_FIXED.relativeoffsetβ the distance between elements within the buffer.
π¦ DESCRIPTION π¦
so glVertexAttribFormat, glVertexAttribIFormat and glVertexAttribLFormat, plus glVertexArrayAttribFormat, glVertexArrayAttribIFormat and glVertexArrayAttribLFormat, are the six functions that specify the organization of data in vertex arrays. the first three calls operate on the bound vertex array object, whereas the last three 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 it must be less than the value of GL_MAX_VERTEX_ATTRIBS.
size determines the number of components per vertex 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, those 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 indicate respectively four signed or unsigned elements packed into a single GLuint; and the value GL_UNSIGNED_INT_10F_11F_11F_REV indicates three floating point values packed into a single GLuint. slay, packed data representation.
glVertexAttribLFormat and glVertexArrayAttribLFormat are 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. no downgrade, no cap.
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. 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. periodt. π
β NOTES β
GL_UNSIGNED_INT_10F_11F_11F_REV is accepted for type only if the GL version is 4.4 or higher. that's the whole note, bestie.
π ERRORS π
GL_INVALID_VALUEis generated ifattribindexis greater than or equal to the value ofGL_MAX_VERTEX_ATTRIBS.GL_INVALID_VALUEis generated ifsizeis not one of the accepted values.GL_INVALID_VALUEis generated ifrelativeoffsetis greater than the value ofGL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.GL_INVALID_ENUMis generated iftypeis not one of the accepted tokens.GL_INVALID_ENUMis generated byglVertexAttribIFormat,glVertexAttribLFormat,glVertexArrayAttribIFormatandglVertexArrayAttribLFormatiftypeisGL_UNSIGNED_INT_10F_11F_11F_REV.GL_INVALID_OPERATIONis generated byglVertexAttribFormat,glVertexAttribIFormatandglVertexAttribLFormatif no vertex array object is bound.GL_INVALID_OPERATIONis generated byglVertexArrayAttribFormat,glVertexArrayAttribIFormatandglVertexArrayAttribLFormatifvaobjis not the name of an existing vertex array object.GL_INVALID_OPERATIONis generated under any of the following conditions:sizeisGL_BGRAandtypeis notGL_UNSIGNED_BYTE,GL_INT_2_10_10_10_REVorGL_UNSIGNED_INT_2_10_10_10_REV.typeisGL_INT_2_10_10_10_REVorGL_UNSIGNED_INT_2_10_10_10_REV, andsizeis neither4norGL_BGRA.typeisGL_UNSIGNED_INT_10F_11F_11F_REVandsizeis not3.sizeisGL_BGRAandnormalizedisGL_FALSE.
π ASSOCIATED GETS π
glGet()with argumentsGL_MAX_VERTEX_ATTRIB_BINDINGS, orGL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET.glGetVertexAttrib()with argumentGL_VERTEX_ATTRIB_RELATIVE_OFFSET.
π VERSION SUPPORT π
OpenGL Version vibe check, bestie β same tea, just in list form instead of a table:
glVertexArrayAttribFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3:-,4.4:-,4.5: βglVertexArrayAttribIFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3:-,4.4:-,4.5: βglVertexArrayAttribLFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3:-,4.4:-,4.5: βglVertexAttribFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3: β,4.4: β,4.5: βglVertexAttribIFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3: β,4.4: β,4.5: βglVertexAttribLFormatβ2.0:-,2.1:-,3.0:-,3.1:-,3.2:-,3.3:-,4.0:-,4.1:-,4.2:-,4.3: β,4.4: β,4.5: β
π SEE ALSO π
glBindVertexBuffer(), glVertexAttribBinding(), glVertexAttribPointer(), glVertexBindingDivisor(), glVertexAttribPointer().
and yes, glVertexAttribPointer() is listed twice; she said what she said π
π 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
mwah π β source/version: [FIXME: source], date: 08/09/2021, and the manual page is GLVERTEXATTRIBFORMAT(3G). bye bestie π«Ά
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms