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, or GL_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:

  • glGetVertexAttribdv and glGetVertexAttribfv return the current attribute values as four single-precision floating-point values.
  • glGetVertexAttribiv reads them as floating-point values and converts them to four integer values.
  • glGetVertexAttribIiv and glGetVertexAttribIuiv read and return them as signed or unsigned integer values, respectively.
  • glGetVertexAttribLdv reads 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_OPERATION is generated if pname is not GL_CURRENT_VERTEX_ATTRIB and there is no currently bound vertex array object.
  • GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS.
  • GL_INVALID_ENUM is generated if pname is not an accepted value.
  • GL_INVALID_OPERATION is generated if index is 0 and pname is GL_CURRENT_VERTEX_ATTRIB.

🧚 ASSOCIATED GETS 🧚

  • glGet() with argument GL_MAX_VERTEX_ATTRIBS
  • glGetVertexAttribPointerv() with arguments index and GL_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 β€” - in 2.0, - in 2.1, then βœ” all the way: 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5
  • glGetVertexAttribIuiv β€” - in 2.0, - in 2.1, then βœ” all the way: 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5
  • glGetVertexAttribLdv β€” - in 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, then βœ” in 4.1, 4.2, 4.3, 4.4, 4.5
  • glGetVertexAttribdv β€” βœ” in 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5
  • glGetVertexAttribfv β€” βœ” in 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5
  • glGetVertexAttribiv β€” βœ” in 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 πŸ“

  • glBindAttribLocation()
  • glBindBuffer()
  • glDisableVertexAttribArray
  • glEnableVertexAttribArray()
  • glVertexAttrib()
  • glVertexAttribDivisor()
  • glVertexAttribPointer()

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