GLGETSHADER(3G)

πŸ’… GLGETSHADER(3G) β€” glGetShaderiv

okay so first of all, bestie, the manual name is 3G (iykyk, OpenGL section) and this whole page is about glGetShaderiv β€” the little function that spills the tea on a shader object. πŸ«–βœ¨

✨ NAME ✨

glGetShaderiv β€” Returns a parameter from a shader object. literally just "tell me about this shader", no cap.

🌸 C SPECIFICATION 🌸

void glGetShaderiv(GLuint shader, GLenum pname, GLint *params);

like, three args, no drama, we love to see it πŸ’–

πŸŽ€ PARAMETERS πŸŽ€

  • shader β€” the shader object you're being nosy about πŸ” which one are we querying, bestie?
  • pname β€” the object parameter. the accepted symbolic names are GL_SHADER_TYPE, GL_DELETE_STATUS, GL_COMPILE_STATUS, GL_INFO_LOG_LENGTH, GL_SHADER_SOURCE_LENGTH. pick one, and it's giving "choose your fighter" πŸ₯Š
  • params β€” where the requested object parameter gets returned. this is the lil mailbox the answer goes into πŸ“¬

πŸ¦‹ DESCRIPTION πŸ¦‹

glGetShader returns in params the value of a parameter for a specific shader object. here's the whole menu, no gatekeeping:

  • GL_SHADER_TYPE β€” params returns GL_VERTEX_SHADER if shader is a vertex shader object, GL_GEOMETRY_SHADER if shader is a geometry shader object, and GL_FRAGMENT_SHADER if shader is a fragment shader object. it's giving "what kind of girlie am i" energy πŸ‘‘
  • GL_DELETE_STATUS β€” params returns GL_TRUE if shader is currently flagged for deletion, and GL_FALSE otherwise. yes bestie, we're checking if it's on its way out πŸ’€
  • GL_COMPILE_STATUS β€” params returns GL_TRUE if the last compile operation on shader was successful, and GL_FALSE otherwise. this is the vibe check for your compile 🧚
  • GL_INFO_LOG_LENGTH β€” params returns the number of characters in the information log for shader including the null termination character (i.e., the size of the character buffer required to store the information log). if shader has no information log, a value of 0 is returned. so like, it's telling you how big a bucket you need πŸͺ£
  • GL_SHADER_SOURCE_LENGTH β€” params returns the length of the concatenation of the source strings that make up the shader source for the shader, including the null termination character. (i.e., the size of the character buffer required to store the shader source). if no source code exists, 0 is returned. sizing up the source, iconic πŸ’…

πŸ™ˆ NOTES πŸ™ˆ

If an error is generated, no change is made to the contents of params. like, nothing moves, the mailbox stays exactly as it was. periodt.

πŸ’€ ERRORS πŸ’€

bestie. when it goes wrong, it goes wrong loudly:

  • GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL. that's not even a real shader, ma'am 😭
  • GL_INVALID_OPERATION is generated if shader does not refer to a shader object. close but no πŸŽ€
  • GL_INVALID_ENUM is generated if pname is not an accepted value. wrong parameter name, wrong vibe, rejected 🚫

πŸ”₯ ASSOCIATED GETS πŸ”₯

  • glGetShaderInfoLog() with argument shader
  • glGetShaderSource() with argument shader
  • glIsShader()

the whole friend group, fr fr 🫢

🌈 VERSION SUPPORT 🌈

every single OpenGL version said "yes queen" to glGetShaderiv:

  • glGetShaderiv is supported in 2.0 βœ”, 2.1 βœ”, 3.0 βœ”, 3.1 βœ”, 3.2 βœ”, 3.3 βœ”, 4.0 βœ”, 4.1 βœ”, 4.2 βœ”, 4.3 βœ”, 4.4 βœ”, and 4.5 βœ”.

not one single version left it on read. we stan a universally supported function πŸ‘‘βœ¨

⭐ SEE ALSO ⭐

  • glCompileShader()
  • glCreateShader()
  • glDeleteShader()
  • glGetProgram()
  • glShaderSource()

go read those too, i'm obsessed with a well-rounded education πŸ“šπŸ’œ

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


ok that's the whole page, bestie, you ate that πŸ’…βœ¨ mwah πŸ’–

sign-off time: this came from [FIXME: source], dated 08/09/2021, and it's page GLGETSHADER(3G) β€” screenshot it, cite it, love it πŸŒΈπŸ¦‹

πŸ“¦ where this page comes from