How can you specify the source code for a shader in OpenGL? a) glShaderCode b) glShaderSource c) glSetShaderCode d) glBindShader
Understand the Problem
The question is asking which OpenGL function is used to specify the source code for a shader. It provides multiple choices and requires the identification of the correct one.
Answer
glShaderSource.
The function used to specify the source code for a shader in OpenGL is glShaderSource
.
Answer for screen readers
The function used to specify the source code for a shader in OpenGL is glShaderSource
.
More Information
In OpenGL, the glShaderSource
function sets the source code in the specified shader object. It takes an array of strings containing the shader code and assigns it to the shader object, replacing any previously stored code.
Sources
- glShaderSource - OpenGL 4 Reference Pages - Khronos Registry - registry.khronos.org