GLCOMPILESHADER(3G)

πŸ’… GLCOMPILESHADER πŸ’…

okay so bestie, welcome to the GLCOMPILESHADER(3G) page β€” yes that 3G means it's an OpenGL manual page, and yes it's giving "I live in the graphics section of the library" ✨. Buckle up, we're compiling shaders fr fr.


πŸŽ€ NAME πŸŽ€

glCompileShader β€” literally compiles a shader object. that's it, that's the whole vibe. 🫢


🌸 C SPECIFICATION 🌸

void glCompileShader(GLuint shader);

look at her. iconic. one parameter, no drama. πŸ‘‘


πŸ¦‹ PARAMETERS πŸ¦‹

  • shader β€” specifies the shader object to be compiled. that's the one, the main character we're about to send off to the compiler πŸ’…

✨ DESCRIPTION ✨

okay so here's the tea: glCompileShader compiles the source code strings that have been stored in the shader object specified by shader. like, the strings you already dropped in there? those. they get compiled. slay. πŸ”₯

the compilation status gets stored as part of the shader object's state, ngl that's kind of important. that value will be set to GL_TRUE if the shader was compiled without errors and is ready for use, and GL_FALSE otherwise 😭 (rip). you can query it by calling glGetShader() with arguments shader and GL_COMPILE_STATUS. that's the vibe check, iykyk.

compilation of a shader can fail for a number of reasons as specified by the OpenGL Shading Language Specification β€” so like, not our fault bestie, the spec said so. and whether or not the compilation was successful, information about the compilation can be obtained from the shader object's information log by calling glGetShaderInfoLog(). yes even when it ate. even when it flopped. the log is always there for you πŸ’œ


🌈 ERRORS 🌈

  • GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL. so if you made that number up?? rude. caught. πŸ’€
  • GL_INVALID_OPERATION is generated if shader is not a shader object. wrong type bestie, wrong type πŸ™ˆ

⭐ ASSOCIATED GETS ⭐

the little besties you can call along with this one:

  • glGetShaderInfoLog() with argument shader
  • glGetShader() with arguments shader and GL_COMPILE_STATUS
  • glIsShader()

πŸ‘‘ VERSION SUPPORT πŸ‘‘

the function/feature name in question is glCompileShader, and she is supported in every single one of these OpenGL versions β€” all checks, no misses, we love a consistent queen:

  • OpenGL 2.0 β€” βœ”
  • OpenGL 2.1 β€” βœ”
  • OpenGL 3.0 β€” βœ”
  • OpenGL 3.1 β€” βœ”
  • OpenGL 3.2 β€” βœ”
  • OpenGL 3.3 β€” βœ”
  • OpenGL 4.0 β€” βœ”
  • OpenGL 4.1 β€” βœ”
  • OpenGL 4.2 β€” βœ”
  • OpenGL 4.3 β€” βœ”
  • OpenGL 4.4 β€” βœ”
  • OpenGL 4.5 β€” βœ”

twelve for twelve. periodt. πŸŽ‰


πŸ“ SEE ALSO πŸ“

  • glCreateShader()
  • glLinkProgram()
  • glShaderSource()

(go read those next bestie, they're the prequel and the sequel 🧚)


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


and that's the whole page!! πŸŽ€ source is [FIXME: source] and the date on this baddie is 08/09/2021 β€” go forth and compile responsibly, bestie, mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from