glGetShader wierd behavior

Hello,

I’m trying to create a Shader program but it seems that I have some errors.
After compiling each shader I check for errors with glGetShaderiv(MyShader, GL_COMPILE, &param), param is returned GL_FALSE and I read the info log with glGetShaderInfoLog(MyShader, MAX_INFO_LOG_LENGTH, 0, InfoLog). The returned InfoLog is “Fragment/Vertex shader was successfully compiled to run on hardware.” but this contradict the fact that param return GL_FALSE.
param is initialized so glGetShader changes the value of param.
The Shader program log returns no errors after the linking process.

Source code:

VertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(VertexShader, 1, &VertexText, 0);
glCompileShader(VertexShader);

FragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(FragmentShader, 1, &FragmentText, 0);
glCompileShader(FragmentShader);

ShaderProgram = glCreateProgram();
glAttachShader(ShaderProgram, VertexShader);
glAttachShader(ShaderProgram, FragmentShader);

glLinkProgram(ShaderProgram);

VolumeDataLoc = glGetUniformLocation(ShaderProgram, VolumeData");
BackfaceDataLoc = glGetUniformLocation(ShaderProgram, “BackfaceData”);

glUseProgram(ShaderProgram);

glUniform1i(VolumeDataLoc, 0);
glUniform1i(BackfaceDataLoc, 1);

(the actual error checking is excluded here but it is simply done with glGetShader followed by glGetShaderInfoLog, I’ve tried checking errors in different parts of the source code but it gives the same results)

I’m using ATI Radeon HD 3600 Series so I should have OpenGL 2.1 support.

Thank you for your help.

I don’t think GL_COMPILE is what you want. That’s for display list compilation. The token you need is GL_COMPILE_STATUS. It may be that your shader is compiling fine, you’re just checking the wrong status.

Cheers,
Graham

Thanks, that did it.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.