I have a GLSL shader that compiles without errors, but validation fails. When I try to render stuff, nothing gets rendered except for other objects that use other valid shaders. Calling glGetError after glDrawElements gives GL_INVALID_OPERATION.
How do I solve this?
I tried a RenderMonkey version, but I had to make a monor modification since texture coord 1 isn’t present in the 3DS models.
It compiles and runs fine in RenderMonkey.
If I run the shader as written in RM, validation still fails so I don’t understand what’s bugging it.
Originally posted by V-man:
If I run the shader as written in RM, validation still fails so I don’t understand what’s bugging it.
Try glValidateProgramARB( handle ) or glValidateProgram( name ), then check the infolog with glGetInfoLogARB( handle, … ) or glGetProgramInfoLog( name, … ) and print the log.
The most common problem is not setting sampler uniforms correctly so that two or more samplers of different type (example: sampler2D, samplerCube, sampler2DShadow) are pointing to the same texture unit (often 0).
(RenderMonkey never sets two samplers to the same unit.)
Originally posted by V-man: If I call validate after using glUniform, then the info log string may be different than before the call to validate?
Of course, you’ve changed the state by using glUniform (especially if you change a sampler uniform), so validate would pass and the info log string will tell you that.