Is there a way to access the shaders attached to a program? That is, given a program, can I do something like:
vertexShader = getVertexShaderFromProgram(program);
(I would like to log shader compilation status within my function that validates my program, but I only keep a reference to the program, not the shaders.)
glGetAttachedShaders()
to get the names of the shaders attached to the given program object.
glGetShaderiv( ..., GL_SHADER_TYPE, ... )
to get the type (vertex, geometry, fragment) of shader.
glGetShaderiv( ..., GL_SHADER_SOURCE_LENGTH, ... )
on each shader name to figure out how long the source is.
glGetShaderSource()
to get the source string for each attached shader.
EDIT: If all you need are the shader names & types you can stop after step 2.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With