GLGETUNIFORMBLOCKIND(3G)

πŸ’… GLGETUNIFORMBLOCKIND

okay bestie, so this is the 3G manual page for glGetUniformBlockIndex β€” dontcha worry, it's a lot less scary than the name sounds, I promise 🫢

✨ NAME ✨

glGetUniformBlockIndex β€” retrieve the index of a named uniform block

πŸŽ€ C SPECIFICATION πŸŽ€

GLuint glGetUniformBlockIndex(GLuint program,
                              const GLchar *uniformBlockName);

🌸 PARAMETERS 🌸

  • program β€” Specifies the name of a program containing the uniform block.
  • uniformBlockName β€” Specifies the address an array of characters to containing the name of the uniform block whose index to retrieve. (yes, that's literally what it says, and yes, the grammar is giving "written at 3am" 😭 but the meaning is: it's the address of a character array holding the name of the uniform block you want the index of πŸ’–)

πŸ¦‹ DESCRIPTION πŸ¦‹

so glGetUniformBlockIndex retrieves the index of a uniform block within program. that's it, that's the whole vibe ✨

πŸ’€ important: program must be the name of a program object for which the command glLinkProgram() must have been called in the past β€” although it is not required that glLinkProgram() must have succeeded. it could have failed because the number of active uniforms exceeded the limit. so like, past link attempt = valid, even a messy one, no cap.

uniformBlockName must contain a nul-terminated string specifying the name of the uniform block.

glGetUniformBlockIndex returns the uniform block index for the uniform block named uniformBlockName of program. If uniformBlockName does not identify an active uniform block of program, glGetUniformBlockIndex returns the special identifier, GL_INVALID_INDEX 🚩 Indices of the active uniform blocks of a program are assigned in consecutive order, beginning with zero. (so the first one's 0, bestie, not 1 β€” don't come for me, that's just how it is 🌈)


πŸ”₯ ERRORS πŸ”₯

  • GL_INVALID_OPERATION is generated if program is not the name of a program object for which glLinkProgram() has been called in the past. πŸ‘€ so if you never tried to link it, that's a you problem and the GL knows.

⭐ NOTES ⭐

glGetUniformBlockIndex is available only if the GL version is 3.1 or greater. lowkey gatekept by the version number πŸ’…

πŸ‘‘ VERSION SUPPORT πŸ‘‘

here's the function-by-feature-name table, laid out flat so we don't do tables (we're too good for tables) β€” the column headers are OpenGL Version 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 the row is glGetUniformBlockIndex slash Feature Name:

  • OpenGL Version 2.0 β€” - (nope)
  • OpenGL Version 2.1 β€” - (nope)
  • OpenGL Version 3.0 β€” - (nope)
  • OpenGL Version 3.1 β€” βœ” yesss
  • OpenGL Version 3.2 β€” βœ”
  • OpenGL Version 3.3 β€” βœ”
  • OpenGL Version 4.0 β€” βœ”
  • OpenGL Version 4.1 β€” βœ”
  • OpenGL Version 4.2 β€” βœ”
  • OpenGL Version 4.3 β€” βœ”
  • OpenGL Version 4.4 β€” βœ”
  • OpenGL Version 4.5 β€” βœ”

it's giving "3.1 onwards, we ate" πŸ“

πŸ’œ SEE ALSO πŸ’œ

  • glGetActiveUniformBlockName()
  • glGetActiveUniformBlock()
  • glLinkProgram()

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


mwah, that's the whole page πŸ’‹ it came from [FIXME: source] (yes, still an unfilled FIXME, iconic honestly πŸ™ˆ) and it's dated 08/09/2021, so if you're reading this in the future β€” hi, hope your uniforms are all bound correctly πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from