Jump to content
  • Advertisement
Sign in to follow this  
dnaxx

Texture movement in vertex shader

This topic is 4526 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello! I want to move textures in the vertex shader this way:
uniform float tmove;

void main()
{
 vec4 t1 = vec4(0.0, -tmove, 0.0,0.0);
 gl_TexCoord[0] = gl_MultiTexCoord0+t1;
}


In the fragment shader I access the texture coordinates this way:
void main()
{
 vec2 UV = gl_TexCoord[0].xy;
 gl_FragColor = texture2D(DTex, UV.xy)
}


Every time the shader is called, the tmove-variable is increased but I do not see any changes. Why doesn't it work? Thank you,

Share this post


Link to post
Share on other sites
Advertisement
I`m not sure but I think gl_TexCoord is a build-in-variable. Maybe it is not allowed to store something new in it. Instead you should define a new varying vec4 and read it out in your fragment-shader. Good luck!

Share this post


Link to post
Share on other sites
Then perhaps you could tell what you did to make it work and why?

Sorry for bitching, but taking the time of others and not giving anything back is considered rude... at least by me.

Cheers!

Share this post


Link to post
Share on other sites
of course. I am a bit "ashamed" because it was a trivial error: instead of passing a float data typ to the shader, I used an integer (glUniformi instead of glUniformf).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!