GLVERTEXBINDINGDIVIS(3G)

πŸ’… GLVERTEXBINDINGDIVIS(3G) β€” the one where your attributes learn to chill

okay so bestie, this is a page from the 3G manual section (OpenGL and friends πŸŽ€), and it's literally all about glVertexBindingDivisor and glVertexArrayBindingDivisor β€” two functions that change how fast your generic vertex attributes advance. yes that's the whole vibe. let's get into it ✨


✨ NAME ✨

glVertexBindingDivisor, glVertexArrayBindingDivisor β€” modify the rate at which generic vertex attributes advance πŸŒ€


🌸 C SPECIFICATION 🌸

void glVertexBindingDivisor(GLuint bindingindex, GLuint divisor);

void glVertexArrayBindingDivisor(GLuint vaobj, GLuint bindingindex,
                                 GLuint divisor);

look at them. two little icons. 🫢


πŸ’– PARAMETERS πŸ’–

  • vaobj β€” the name of the vertex array object for the glVertexArrayBindingDivisor function. that's the VAO you're targeting, bestie.
  • bindingindex β€” the index of the binding whose divisor you want to modify. point at it. πŸ‘‰πŸ’…
  • divisor β€” the new value for the instance step rate to apply. the fresh number. ✨

πŸ¦‹ DESCRIPTION πŸ¦‹

so glVertexBindingDivisor and glVertexArrayBindingDivisor modify the rate at which generic vertex attributes advance when you're rendering multiple instances of primitives in a single draw command. multi-instance rendering hours, fr fr. πŸ”₯

here's the tea on divisor:

  • if divisor is zero, the attributes using the buffer bound to bindingindex advance once per vertex. one vertex, one step. no cap. πŸšΆβ€β™€οΈ
  • if divisor is non-zero, the attributes advance once per divisor instances of the set(s) of vertices being rendered. so like, it paces itself. ✨

and an attribute is referred to as instanced if the corresponding divisor value is non-zero. that's the official terminology, iykyk. πŸ‘‘

the difference between the two functions, because yes there is one:

  • glVertexBindingDivisor uses the currently bound vertex array object.
  • glVertexArrayBindingDivisor updates the state of the vertex array object with ID vaobj.

same energy, different target. πŸ’«


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE is generated if bindingindex is greater than or equal to the value of GL_MAX_VERTEX_ATTRIB_BINDINGS. out of range, babe. πŸ™ˆ
  • GL_INVALID_OPERATION by glVertexBindingDivisor is generated if no vertex array object is bound. nothing bound = nothing to do. 😭
  • GL_INVALID_OPERATION is generated by glVertexArrayBindingDivisor if vaobj is not the name of an existing vertex array object. ghost VAO. not real. πŸ’€

πŸ” ASSOCIATED GETS πŸ”

you can peek at this state with glGet() using these arguments:

  • GL_MAX_VERTEX_ATTRIB_BINDINGS
  • GL_VERTEX_BINDING_DIVISOR

go check on it. it's giving transparency. 🧚


🌈 VERSION SUPPORT 🌈

the original ships a big table, but here it is in list form because we're cute like that β€” every single version is accounted for, promise 🫢 (columns are 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, and βœ” means supported, - means not):

  • glVertexArrayBindingDivisor β€” - in 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. late bloomer, main character energy. πŸ‘‘
  • glVertexBindingDivisor β€” - in 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, 4.0, 4.1, 4.2; βœ” in 4.3, 4.4, 4.5. arrived in 4.3 and never left. πŸ”₯

πŸŽ€ SEE ALSO πŸŽ€

go read these next, bestie, they're all linked up:

  • glBindVertexBuffer()
  • glVertexAttribBinding()
  • glVertexAttribPointer()
  • glVertexBindingDivisor()
  • glVertexAttribPointer()

(yes glVertexAttribPointer() shows up twice in the original list and yes glVertexBindingDivisor() is listed on its own page β€” we don't editorialize, we just report. πŸ™ˆ)


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 Β© 2013-2014 Khronos Group


okay that's the whole page, no notes πŸ’… go forth and set those divisors, bestie 🌸

mwah πŸ’‹ this was [FIXME: source], dated 08/09/2021, and it's the GLVERTEXBINDINGDIVIS(3G) page β€” see u in the next one πŸ¦‹

πŸ“¦ where this page comes from