It seems that sometimes the glsl shader fails to link. whether or not that’s because of an error in the code, the problem is that I have a hard time getting it to link again.
for example,
I had this shader:
void main()
{
vec4 col1 = texture2D(sInput1, gl_TexCoord[0].st);
vec4 col2 = texture2D(sInput2, gl_TexCoord[0].st);
// Do your expression here. Right now it's simply input1 * input2.
vec4 outcol = col1;
if ( ( outcol.r > outcol.b ) || ( outcol.b < .2 ) ) {
outcol.a = 1;
} else {
outcol.a = 0;
}
// write out the result.
gl_FragColor = outcol;
}
I then added, right before the //write out the result:
outcol.b = outcol.r;
which, for some unknown reason, failed to link (it would be nice if some error was printed, I see type casting warnings but no errors on more serious stuff).
I then deleted the offending line, and wrote out the shader again, but it failed to link again, even though it was working fine a few seconds prior.
Any clues?
thanks,
dani