glGetShaderSource - Returns the source code string from a shader object
Contents
Associated Gets
glGetShader() with argument GL_SHADER_SOURCE_LENGTHglIsShader()
C Specification
voidglGetShaderSource(GLuintshader,GLsizeibufSize,GLsizei*length,GLchar*source);
Copyright
Copyright © 2003-2005 3Dlabs Inc. Ltd.
Copyright © 2010-2014 Khronos Group
[FIXME: source] 11/18/2024 GLGETSHADERSOURCE(3G)
Description
glGetShaderSource returns the concatenation of the source code strings from the shader object specified
by shader. The source code strings for a shader object are the result of a previous call to
glShaderSource(). The string returned by the function will be null terminated.
glGetShaderSource returns in source as much of the source code string as it can, up to a maximum of
bufSize characters. The number of characters actually returned, excluding the null termination character,
is specified by length. If the length of the returned string is not required, a value of NULL can be
passed in the length argument. The size of the buffer required to store the returned source code string
can be obtained by calling glGetShader() with the value GL_SHADER_SOURCE_LENGTH.
Errors
GL_INVALID_VALUE is generated if shader is not a value generated by OpenGL.
GL_INVALID_OPERATION is generated if shader is not a shader object.
GL_INVALID_VALUE is generated if bufSize is less than 0.
Name
glGetShaderSource - Returns the source code string from a shader object
Parameters
shader
Specifies the shader object to be queried.
bufSize
Specifies the size of the character buffer for storing the returned source code string.
length
Returns the length of the string returned in source (excluding the null terminator).
source
Specifies an array of characters that is used to return the source code string.
See Also
glCreateShader(), glShaderSource()
Version Support
┌───────────────────┬───────────────────────────────────────────────────────────────────────┐
│ │ OpenGLVersion │
├───────────────────┼─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┤
│ 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 │ │ │ │ │ │ │ │ │ │ │ │ │
├───────────────────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┼─────┤
│ glGetShaderSource │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │ ✔ │
└───────────────────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┘
