Expand/Shrink

glShaderSource

Definition: include pGUI.e
include opengl.e

glShaderSource(integer shader, string source)
Description: Replaces the source code in a shader object

shader: Specifies the handle of the shader object whose source code is to be replaced.
source: Specifies an array of pointers to strings containing the source code to be loaded into the shader.
Note that in contrast to the C api, which accepts a count and arrays of strings and length, this (currently) only allows a single source which is assumed to be null terminated, so there is no need for a length array.
pwa/p2js: Supported.
Notes: glShaderSource sets the source code in shader to the source code in the array of strings specified by string.
Any source code previously stored in the shader object is completely replaced.
The source code string is not scanned or parsed at this time; it is simply copied into the specified shader object.

OpenGL copies the shader source code strings when glShaderSource is called, so an application may free its copy of the source code strings immediately after the function returns.
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 count is less than 0.
Associated Gets: glGetShaderSource with argument shader
glIsShader
See Also: glCompileShader, glCreateShader, glDeleteShader