Sign in to follow this  
Lehm

GLSL texture2D problem.

Recommended Posts

I've asked this elsewhere but no one has been able to help me. I have a fragment shader... uniform sampler2D bTexture,tTexture,lTexture; float maxC; vec4 tColor1,tColor2,lColor; void main(void){ tColor1=texture2D(bTexture,vec2(gl_TexCoord[0])); tColor2=texture2D(tTexture,vec2(gl_TexCoord[1])); lColor=texture2D(lTexture,vec2(gl_TexCoord[2]))+((gl_Color)-0.5); gl_FragColor=vec4(vec3(mix(tColor1,tColor2,tColor2.a)),tColor1.a+tColor2.a)*lColor; } This code works perfectly on Geforce cards. Problem is that it runs slowly on Radeon cards. If I remove the call to texture2D the problem goes away. So I think the problem is there. But I'm unsure what's causing the problem.

Share this post


Link to post
Share on other sites
You shouldn't query the UV coords from the fragment shader.
Make a varying variable to store the UV coords and then use that varying from the fragment shader.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this