What is wrong with this shader?

Hi all,

when i try to load this shader, i get “invalid operation”

const GLchar* source =
"
uniform samplerRect TSAMP0;
uniform sampler2D TSAMP1;
void main(void)
{
vec4 c0 = textureRect(TSAMP0,gl_FragCoord.xy);
vec4 c1 = texture2D(TSAMP1,gl_TexCoord[0].xy);
gl_FragColor = c0 * c1;
}
";

the error is not related to any application state / condition, when i load simpler shaders ( without texture uniforms ) everything runs fine. The same code runs fine on windows. I get my problems with Mac OS 10.6.7

Anyone knows what is wrong with this shader?
Is it allowed to mix sampler2D / samplerRect on Mac OS X?

There is no such thing as samplerRect. There is only sampler2DRect. On windows NVIDIA incorrectly accepts samplerRect.

when i try to load this shader, i get “invalid operation”

BTW, when you load shaders, the compiler/linker will tell you when you have done something wrong. They have a message log. You don’t have to wait until render time to know that a shader is broken.

perfect! thank you! and i had to use texture2DRect, too.
It is always dangerous to develop under windows and then switch to macos …

yes, and i am always checking link success - and the shader compiled fine but did not load. ( really strange… )

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