GLGETUNIFORMINDICES(3G)

okay so bestie πŸ’– you've stumbled into the OpenGL corner of the manual β€” this is GLGETUNIFORMINDICES from the 3G manual, and honestly? it's a little baddie of a function. let's get into it.

✨ NAME ✨

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


πŸŽ€ C SPECIFICATION πŸŽ€

like, here's the actual signature, don't come for me about the line breaks:

void glGetUniformIndices(GLuint program, GLsizei uniformCount,
                         const GLchar **uniformNames,
                         GLuint *uniformIndices);

πŸ¦‹ PARAMETERS πŸ¦‹

  • program β€” the name of a program containing the uniforms whose indices you wanna query πŸ‘€
  • uniformCount β€” how many uniforms you're querying indices for, bestie. that's the count. that's the number.
  • uniformNames β€” the address of an array of pointers to buffers that hold the names of the queried uniforms. yes, pointers to buffers. no, i'm not kidding πŸ™ˆ
  • uniformIndices β€” the address of an array that's gonna receive the indices of the uniforms. it's giving output parameter energy ✨

πŸ’œ DESCRIPTION πŸ’œ

glGetUniformIndices retrieves the indices of a number of uniforms within program. simple as that, no cap.

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 😭. yeah. the link could have failed because the number of active uniforms exceeded the limit, and that's still valid here. iconic behaviour honestly.

uniformCount indicates both the number of elements in the array of names uniformNames and the number of indices that may be written to uniformIndices. one number, two jobs, main character energy πŸ‘‘

uniformNames contains a list of uniformCount name strings identifying the uniform names to be queried for indices. for each name string in uniformNames, the index assigned to the active uniform of that name will be written to the corresponding element of uniformIndices. and if a string in uniformNames is not the name of an active uniform? the special value GL_INVALID_INDEX gets written to the corresponding element of uniformIndices instead πŸ’… the more you know.

if an error occurs, nothing is written to uniformIndices. like, at all. zero. nada. 🫢

🌸 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 like... call glLinkProgram() first, bestie. please.

⭐ NOTES ⭐

glGetUniformIndices is available only if the GL version is 3.1 or greater. sad for the old heads, slay for everyone else πŸŽ€


🌈 VERSION SUPPORT 🌈

here's the whole vibe check, verbatim, because i would never gatekeep:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     β”‚                OpenGL Version                                         β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€
β”‚ Function            β”‚ 2.0 β”‚ 2.1 β”‚ 3.0 β”‚ 3.1 β”‚ 3.2 β”‚ 3.3 β”‚ 4.0 β”‚ 4.1 β”‚ 4.2 β”‚ 4.3 β”‚ 4.4 β”‚ 4.5 β”‚
β”‚ /                   β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚
β”‚ Feature             β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚
β”‚ Name                β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚     β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€
β”‚ glGetUniformIndices β”‚  -  β”‚  -  β”‚  -  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚  βœ”  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”˜

so basically: - for 2.0, 2.1 and 3.0, then a big fat βœ” from 3.1 all the way through 4.5. ate and left no crumbs πŸ’€


πŸ”₯ SEE ALSO πŸ”₯

  • glGetActiveUniform()
  • glGetActiveUniformName()
  • glLinkProgram()

go read those too, iykyk 🧚


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


and that's the whole page, bestie πŸ“ β€” massive love to <pink>[FIXME: source]</pink> for the source and to <purple>08/09/2021</purple> for the date, that's when this little queen was last touched up. now go call glLinkProgram() and slay πŸ’…βœ¨

πŸ“¦ where this page comes from