GLGETPROGRAMBINARY(3G)
πΈ GLGETPROGRAMBINARY π
okay so real talk, this one lives in the 3G corner of the manual (that's the OpenGL section bestie, don't @ me) and it's genuinely such a useful little function. it's glGetProgramBinary and it's about to hand you your whole compiled+linked program as a raw binary blob. slay.
β¨ NAME β¨
glGetProgramBinary β return a binary representation of a program object's compiled and linked executable source π
β¨ C SPECIFICATION β¨
like, this is the exact signature, no cap, copy it character for character:
void glGetProgramBinary(GLuint program, GLsizei bufSize,
GLsizei *length, GLenum *binaryFormat,
void *binary);
β¨ PARAMETERS β¨
programβ the name of the program object whose binary representation you wanna retrieve. that's your main character right there πbufSizeβ the size of the buffer whose address is given bybinary. aka how much room you're giving it.lengthβ the address of a variable that receives the number of bytes actually written intobinary. it's giving "receipts" πbinaryFormatβ the address of a variable that receives a token indicating the format of the binary data the GL returned. iykyk π¦binaryβ the address of an array into which the GL will return the program's binary representation. this is where the good stuff lands β¨
β¨ DESCRIPTION β¨
okay so glGetProgramBinary returns a binary representation of the compiled and linked executable for program, dropping it into the array of bytes whose address is specified in binary. iconic behavior, honestly.
the maximum number of bytes that may be written into binary is specified by bufSize. and here's the important bit bestie β if the program binary is greater in size than bufSize bytes, then an error is generated π otherwise the actual number of bytes written into binary gets returned in the variable whose address is given by length. and if length is NULL, then no length is returned. no vibe check, no receipt, it just doesn't tell you.
the format of the program binary written into binary is returned in the variable whose address is given by binaryFormat, and it may be implementation dependent β so like, don't assume it's the same everywhere, fr fr π
the binary the GL produces may subsequently be returned to the GL by calling glProgramBinary(), with binaryFormat and length set to the values returned by glGetProgramBinary, and passing the returned binary data in the binary parameter. it's a whole round trip and it ate π₯
β¨ ERRORS β¨
heads up bestie, these two will absolutely ruin your day if you're not paying attention π
GL_INVALID_OPERATIONis generated ifbufSizeis less than the size ofGL_PROGRAM_BINARY_LENGTHforprogram.GL_INVALID_OPERATIONis generated ifGL_LINK_STATUSfor the program object is false. like, if it didn't link, there's nothing to give you, periodt.
β¨ ASSOCIATED GETS β¨
glGetProgram() with argument GL_PROGRAM_BINARY_LENGTH π«Ά
β¨ VERSION SUPPORT β¨
so the original ships a big sparkly grid of OpenGL versions here β i can't draw you the box, but the facts are literally the same, no cap. glGetProgramBinary is not supported in OpenGL 2.0, 2.1, 3.0, 3.1, 3.2, 3.3, or 4.0 (all -), and it is supported in OpenGL 4.1, 4.2, 4.3, 4.4, and 4.5 (all β) β¨
- 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β β
β¨ SEE ALSO β¨
glGetProgram(), glProgramBinary() β go read those too, they're the supporting cast and they understood the assignment π
β¨ COPYRIGHT β¨
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 (again, yes really) β¨
Copyright Β© 2010-2014 Khronos Group
okay that's the whole page bestie, go compile something gorgeous π β¨
πΈ mwah, this rewrite was brought to you by [FIXME: source], dated 08/09/2021, and the original GLGETPROGRAMBINARY(3G) header/footer energy β see u in the group chat π«Άπ
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms