Jump to content
  • Advertisement
Sign in to follow this  
Ishilra

OpenGL CG Texture Warping

This topic is 3477 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 have a simple problem in OpenGL & CG. In my course project, I have to warp the texture that I have in the framebuffer. I managed to send the texture in the framebuffer to fragment shader and display it using tex2d, however, I have no idea on altering the texture coordinates. For instance, if I had a direction vector, how can I stretch the image in that direction? Any guides will be really helpful. Thanks a lot. PS: Sorry for my bad English.

Share this post


Link to post
Share on other sites
Advertisement
Well, in the fragment shader you have the texture coords of the current fragment. Change them before calling tex2d, i.e. you move the coords along the given direction (taking some strechfactor into accoung, e.g. the length of the direction vector).

If you also employ a factor based on the texture coordinate you could get some stretching effect.

Or move the coords in the positve/negative direction based on their distance to some point/line, e.g. the center.

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!