GLGETVERTEXATTRIB(3G)
β¨ GLGETVERTEXATTRIB(3G) β¨
okay bestie, so this is a page from the [FIXME: manual] set (yes, that's literally the manual name, we don't make the rules π
) and it's all about glGetVertexAttrib β the little family of calls that lets you peek at a generic vertex attribute parameter. Lowkey essential, highkey underrated.
π NAME π
glGetVertexAttribdv, glGetVertexAttribfv, glGetVertexAttribiv, glGetVertexAttribIiv, glGetVertexAttribIuiv, glGetVertexAttribLdv β "Return a generic vertex attribute parameter". Six icons, one job. Periodt.
π C SPECIFICATION π
here's the exact tea, character for character, no edits:
void glGetVertexAttribdv(GLuint index, GLenum pname, GLdouble *params);
void glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params);
void glGetVertexAttribiv(GLuint index, GLenum pname, GLint *params);
void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
void glGetVertexAttribLdv(GLuint index, GLenum pname, GLdouble *params);
πΈ PARAMETERS πΈ
indexβ which generic vertex attribute parameter you're asking about. Like picking which friend to text, but it's an index. π«Άpnameβ the symbolic name π·οΈ of the vertex attribute parameter you wanna query. The accepted values are:GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING,GL_VERTEX_ATTRIB_ARRAY_ENABLED,GL_VERTEX_ATTRIB_ARRAY_SIZE,GL_VERTEX_ATTRIB_ARRAY_STRIDE,GL_VERTEX_ATTRIB_ARRAY_TYPE,GL_VERTEX_ATTRIB_ARRAY_NORMALIZED,GL_VERTEX_ATTRIB_ARRAY_INTEGER,GL_VERTEX_ATTRIB_ARRAY_DIVISOR, orGL_CURRENT_VERTEX_ATTRIB.paramsβ where the requested data comes back to you. the drop-off point π¦
π¦ DESCRIPTION π¦
glGetVertexAttrib hands you back, in params, the value of a generic vertex attribute parameter. You say which generic vertex attribute by passing index, and you say which parameter by passing pname. Slay, that's it, that's the whole relationship. β¨
here are the accepted parameter names, and what each one gives you:
π GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING
params returns a single value β the name of the buffer object currently bound to the binding point that corresponds to generic vertex attribute array index. If no buffer object is bound, you get 0. The initial value is 0.
π GL_VERTEX_ATTRIB_ARRAY_ENABLED
params returns a single value that is non-zero (true) if the vertex attribute array for index is enabled, and 0 (false) if it's disabled. The initial value is GL_FALSE. not me checking if the array is even awake π
π GL_VERTEX_ATTRIB_ARRAY_SIZE
params returns a single value β the size of the vertex attribute array for index. The size is the number of values for each element of the vertex attribute array, and it will be 1, 2, 3, or 4. The initial value is 4.
π GL_VERTEX_ATTRIB_ARRAY_STRIDE
params returns a single value β the array stride for (aka the number of bytes between successive elements in) the vertex attribute array for index. A value of 0 indicates that the array elements are stored sequentially in memory. The initial value is 0.
π GL_VERTEX_ATTRIB_ARRAY_TYPE
params returns a single value β a symbolic constant indicating the array type for the vertex attribute array for index. Possible values are GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_INT, GL_UNSIGNED_INT, GL_FLOAT, and GL_DOUBLE. The initial value is GL_FLOAT.
π GL_VERTEX_ATTRIB_ARRAY_NORMALIZED
params returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by index are normalized when they're converted to floating point, and 0 (false) otherwise. The initial value is GL_FALSE.
π GL_VERTEX_ATTRIB_ARRAY_INTEGER
params returns a single value that is non-zero (true) if fixed-point data types for the vertex attribute array indicated by index have integer data types, and 0 (false) otherwise. The initial value is 0 (GL_FALSE).
π GL_VERTEX_ATTRIB_ARRAY_DIVISOR
params returns a single value that is the frequency divisor used for instanced rendering. See glVertexAttribDivisor(). The initial value is 0.
π GL_CURRENT_VERTEX_ATTRIB
params returns four values that represent the current value for the generic vertex attribute specified by index. And here's the plot twist: generic vertex attribute 0 is unique in that it has no current state, so an error will be generated if index is 0. π The initial value for all other generic vertex attributes is (0,0,0,1).
and now, the conversion cubicle β who reads it as what:
glGetVertexAttribdvandglGetVertexAttribfvreturn the current attribute values as four single-precision floating-point values.glGetVertexAttribivreads them as floating-point values and converts them to four integer values.glGetVertexAttribIivandglGetVertexAttribIuivread and return them as signed or unsigned integer values, respectively.glGetVertexAttribLdvreads and returns them as four double-precision floating-point values.
fr fr important: all of the parameters except GL_CURRENT_VERTEX_ATTRIB represent state stored in the currently bound vertex array object. iykyk. π
π NOTES π
If an error is generated, no change is made to the contents of params. your buffer stays exactly as it was, no cap. π«Ά
π₯ ERRORS π₯
the vibe check failures, in order:
GL_INVALID_OPERATIONis generated ifpnameis notGL_CURRENT_VERTEX_ATTRIBand there is no currently bound vertex array object.GL_INVALID_VALUEis generated ifindexis greater than or equal toGL_MAX_VERTEX_ATTRIBS.GL_INVALID_ENUMis generated ifpnameis not an accepted value.GL_INVALID_OPERATIONis generated ifindexis0andpnameisGL_CURRENT_VERTEX_ATTRIB.
π§ ASSOCIATED GETS π§
glGet()with argumentGL_MAX_VERTEX_ATTRIBSglGetVertexAttribPointerv()with argumentsindexandGL_VERTEX_ATTRIB_ARRAY_POINTER
β VERSION SUPPORT β
the original is a whole big table, and we're not doing tables here, so here's the same data laid out as a lil list β every β and every - preserved, don't worry bestie π
glGetVertexAttribIivβ-in2.0,-in2.1, then β all the way:3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5glGetVertexAttribIuivβ-in2.0,-in2.1, then β all the way:3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5glGetVertexAttribLdvβ-in2.0,2.1,3.0,3.1,3.2,3.3,4.0, then β in4.1,4.2,4.3,4.4,4.5glGetVertexAttribdvβ β in2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5glGetVertexAttribfvβ β in2.0,2.1,3.0,3.1,3.2,3.3,4.0,4.1,4.2,4.3,4.4,4.5glGetVertexAttribivβ β in2.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 π
glBindAttribLocation()glBindBuffer()glDisableVertexAttribArrayglEnableVertexAttribArray()glVertexAttrib()glVertexAttribDivisor()glVertexAttribPointer()
π COPYRIGHT π
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-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 Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group
and that's the whole page, bestie!! πΈπ¦ this came to you from [FIXME: source], dated 08/09/2021 β go forth and query your vertex attributes, you absolute main character π
β¨
π¦ 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