GLGETACTIVESUBROUTIN(3G)

πŸ’… GLGETACTIVESUBROUTIN (3G) β€” the "what's ur subroutine's name bestie" page

okay so this is a page from the 3G manual section (that's the OpenGL one, iykyk) and it's literally all about getting the name of an active shader subroutine. sounds niche? it is. but it's also kinda iconic. let's go 🫢


✨ NAME ✨

glGetActiveSubroutineName β€” query the name of an active shader subroutine


🧾 C SPECIFICATION 🧾

bestie this is the actual signature, copy it exactly, no cap:

void glGetActiveSubroutineName(GLuint program, GLenum shadertype,
                               GLuint index, GLsizei bufSize,
                               GLsizei *length, GLchar *name);

πŸŽ€ PARAMETERS πŸŽ€

  • program β€” the name of the program that's holding your subroutine. like, which program are we even talking about.
  • shadertype β€” which shader stage you're pulling the subroutine name out of.
  • index β€” the index of the shader subroutine uniform. yes you need to know which one.
  • bufSize β€” how big the buffer is, the one whose address you passed in name. keep it real, don't overflow 🌸
  • length β€” address of a variable that's gonna receive the length of the shader subroutine uniform's name.
  • name β€” address of an array where the shader subroutine uniform's name gets written. this is the whole point tbh πŸ’–

🌟 DESCRIPTION 🌟

So glGetActiveSubroutineName queries the name of an active shader subroutine uniform from the program object you handed over in program. the index argument says which shader subroutine uniform you want, inside the shader stage given by stage, and it must be between zero and the value of GL_ACTIVE_SUBROUTINES minus one for that shader stage. read that again. minus one. periodt.

The name of the selected subroutine comes back as a null-terminated string in name. The actual number of characters written into name β€” not counting the null-terminator β€” gets returned in length. If length is NULL, then no length is returned, simple as that. The maximum number of characters that may be written into name, null-terminator included, is given by bufSize. budget ur bytes bestie πŸŽ€


πŸ’€ ERRORS πŸ’€

  • GL_INVALID_VALUE gets generated if index is greater than or equal to the value of GL_ACTIVE_SUBROUTINES. out of bounds = not the vibe.
  • GL_INVALID_VALUE gets generated if program is not the name of an existing program object. like, that program doesn't exist, babes 😭

πŸ” ASSOCIATED GETS πŸ”

  • glGetProgramStage() with argument GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH

πŸ‘‘ VERSION SUPPORT πŸ‘‘

the original lays this out in a big table, but tables are so not terminal-core, so here's the tea in list form β€” same facts, zero spreadsheets πŸ’…

Function / Feature Name: glGetActiveSubroutineName

OpenGL 2.0 β€” not supported (-) OpenGL 2.1 β€” not supported (-) OpenGL 3.0 β€” not supported (-) OpenGL 3.1 β€” not supported (-) OpenGL 3.2 β€” not supported (-) OpenGL 3.3 β€” not supported (-)

and then:

OpenGL 4.0 β€” supported (βœ”) OpenGL 4.1 β€” supported (βœ”) OpenGL 4.2 β€” supported (βœ”) OpenGL 4.3 β€” supported (βœ”) OpenGL 4.4 β€” supported (βœ”) OpenGL 4.5 β€” supported (βœ”)

so like, 4.0 and up only. glow up era only πŸ’–βœ¨


πŸ¦‹ SEE ALSO πŸ¦‹

  • glGetSubroutineIndex()
  • glGetActiveSubroutineUniform()
  • glGetProgramStage()

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.


ngl the header up top says GLGETACTIVESUBROUTIN(3G) and yeah β€” <rainbow>Khronos Group says hi, this is from [FIXME: source], dated 08/09/2021, and that's the whole manpage bestie πŸ«ΆπŸ’œ</rainbow>
πŸ“¦ where this page comes from