GLENABLEVERTEXATTRIB(3G)

okay so bestie, we're looking at the 3G manual page for glEnableVertexAttribArray and its whole little friend group β€” the functions that flip generic vertex attribute arrays on and off. It's giving "tiny page, huge consequences" energy. Let's go πŸ’…


✨ NAME ✨

glEnableVertexAttribArray, glDisableVertexAttribArray, glEnableVertexArrayAttrib, glDisableVertexArrayAttrib β€” literally just enable or disable a generic vertex attribute array. That's the whole gig. Turn it on, turn it off. Iconic. πŸŽ€


🌸 C SPECIFICATION 🌸

void glEnableVertexAttribArray(GLuint index);

void glDisableVertexAttribArray(GLuint index);

void glEnableVertexArrayAttrib(GLuint vaobj, GLuint index);

void glDisableVertexArrayAttrib(GLuint vaobj, GLuint index);

πŸ¦‹ PARAMETERS πŸ¦‹

  • vaobj β€” the name of the vertex array object, but only for glDisableVertexArrayAttrib and glEnableVertexArrayAttrib. The other two don't even wanna hear about it πŸ’€
  • index β€” which generic vertex attribute you're enabling or disabling. Just the index, bestie.

πŸ’– DESCRIPTION πŸ’–

glEnableVertexAttribArray and glEnableVertexArrayAttrib enable the generic vertex attribute array that index points at. The difference? glEnableVertexAttribArray uses the vertex array object that's currently bound for the operation, whereas glEnableVertexArrayAttrib goes and updates the state of the vertex array object with ID vaobj. Same energy, different target 🎯

glDisableVertexAttribArray and glDisableVertexArrayAttrib disable the generic vertex attribute array specified by index. And yeah, same split: glDisableVertexAttribArray uses the currently bound vertex array object for the operation, whereas glDisableVertexArrayAttrib updates the state of the vertex array object with ID vaobj.

By default, all client-side capabilities are disabled, and that includes every single generic vertex attribute array. All of them. Off. Asleep. πŸ’€

If it is enabled, tho? Then the values in the generic vertex attribute array get accessed and used for rendering whenever calls are made to vertex array commands like glDrawArrays(), glDrawElements(), glDrawRangeElements(), glMultiDrawElements(), or glMultiDrawArrays(). That's the whole point, periodt 🌟


πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_OPERATION is generated by glEnableVertexAttribArray and glDisableVertexAttribArray if no vertex array object is bound. Yes, you need one. No, you can't skip it. 😭
  • GL_INVALID_OPERATION is generated by glEnableVertexArrayAttrib and glDisableVertexArrayAttrib if vaobj is not the name of an existing vertex array object. Ghost VAO behavior is not it, bestie πŸ‘»
  • GL_INVALID_VALUE is generated if index is greater than or equal to GL_MAX_VERTEX_ATTRIBS. Respect the ceiling 🚫

🧚 ASSOCIATED GETS 🧚

  • glGet() with argument GL_MAX_VERTEX_ATTRIBS
  • glGetVertexAttrib() with arguments index and GL_VERTEX_ATTRIB_ARRAY_ENABLED
  • glGetVertexAttribPointerv() with arguments index and GL_VERTEX_ATTRIB_ARRAY_POINTER

πŸ‘‘ VERSION SUPPORT πŸ‘‘

So the original lays this out as a big grid of OpenGL versions β€” 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4, 4.5 β€” with a βœ” or a - for each function. Here's that same tea, function by function β˜•

  • glDisableVertexArrayAttrib β€” - for 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4; βœ” only in 4.5. She's a late bloomer, we stan πŸ’œ
  • glDisableVertexAttribArray β€” βœ” 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. Everywhere. Always. Main character energy 🌈
  • glEnableVertexArrayAttrib β€” - for 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2, 4.3, 4.4; βœ” in 4.5. Twin behavior with her disable sister 🫢
  • glEnableVertexAttribArray β€” βœ” 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. Certified everywhere legend ⭐

πŸ“ SEE ALSO πŸ“

glBindAttribLocation(), glDrawArrays(), glDrawElements(), glDrawRangeElements(), glMultiDrawElements(), glVertexAttrib(), glVertexAttribPointer() β€” go read these too, iykyk πŸ“š


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 page, bestie 🫢 the source line is literally [FIXME: source] (placeholder behavior, we love a mystery ✨) and it's dated 08/09/2021, all wrapped up as GLENABLEVERTEXATTRIB(3G). Go forth and enable some arrays πŸ’–

πŸ“¦ where this page comes from