Jump to content
  • Advertisement
Sign in to follow this  
Zakwayda

Clamping and texcoord modulation

This topic is 5135 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

I'm working on a simple Quake 3 style shader system. I have various texture coordinate modulations (rotate and stretch), that transform to the center of uv space, perform the modulation, and transform back, like this: glTranslatef(-0.5f, -0.5f, 0.0f); glScalef(s, s, 1.0f); glTranslatef(0.5f, 0.5f, 0.0f); This works fine, *except* when the texture in question is set to CLAMP or CLAMP_TO_EDGE instead of REPEAT. When the texture is clamped, the texture 'bounces' in the v dimension in addition to stretching. When the texture is not clamped, it works fine, except of course for the unwanted repeating. This is the effect used on i.e. the jumppads in Quake. It obviously works fine there, so I must be doing something wrong. Any ideas? Thanks very much.

Share this post


Link to post
Share on other sites
Advertisement
Your translations are simply done in the wrong direction. When the textures repeat it doesn't matter since you'll just end up one whole texture to the right (or left).

glTranslatef(0.5f, 0.5f, 0.0f);
glScalef(s, s, 1.0f);
glTranslatef(-0.5f, -0.5f, 0.0f);

Will probably work a lot better (it does for me anyway).

Good luck!

Share this post


Link to post
Share on other sites
Weird. I actually tried that earlier, but it didn't help. I just tried it again, though, and it's fixed! I must have changed something else in between that made a difference.

So thanks very much :-)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!