I have some shader code/routines that define several GLSL functions as strings and compiles them as smaller individual shader objects. Then before each pass I create a main program and attach (using glAttachObject) the necessary smaller objects (depending on my current pass and needs) to the main program. Once everything is attached I perform a link and call glUseProgramObject() on the main program.
The shaders work, as I see a correct scene drawn.
However, when I call glGetShaderSource() after I call glUseProgramObject() it returns nothing? Is it because I never called glShaderSource()? I want to be able to spit out my current shader (which changes as my passes change) at a given point but I can’t seem to get GL to return the shader via glGetShaderSource?
glGetError() does report an error but simple returns INVALID_OPERATION.
Any ideas? Here is the code I am using to do the query…
GLchar buffer[5000];
GLsizei size;
GLuint shader;
shader = program; // Program is the GLhandleARB for the shader
glGetShaderSourceARB (shader, 5000, &size, &buffer[0]);
error = glGetError(); // Returns INVALID_OPERATION