Sign in to follow this  

Texture Matrix Problems

This topic is 3735 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 want to rotate/scale around a point (x,y) in texture space. And I want it to relate to a point in regular modelview space. I'm going to try to explain it as good as I can, I feel my english is lacking a bit at this hour. :) I have a quad covering the entire screen (ortho mode, 0,0 to 1,1) with a texture applied to it. This quad should stay at the same coords all the time, and just update its texture matrix. So when I translate 5 units to the right in modelview space, I translate 5 units to the right in texture space as well. This part works good, but when I try to implement rotation and scale it all falls apart. :) I tried to use the same values for translate/rotate/scale but it doesn't work. I'm doing it like this: TextureMatrix Translate to center Rotate Scale Draw quad ModelViewMatrix Translate to center Rotate Scale Draw objects Any tips would be helpful!

Share this post


Link to post
Share on other sites
If you don't want to move your screen covering quad, why move it 5 units to the right?
Anyway, I guess playing with the order of transforms ( and their signs ) will help you.

xibo

Share this post


Link to post
Share on other sites
Sorry for not clarifying my problem. I'm making a game where you need to collect different species of bugs that wander around on an "endless" patch of grass. Instead of rendering lots of polygons for the grass, I only want to render one quad and let the texture matrix do the rest.

So all of the bugs are positioned in world space (2D), but the grass quad is always 0,0 to 1,1, no matter the transformation. In order for the grass quad to be able to stay at those coords, yet still give the impression of camera movement, I need to transform its texture matrix to get similar results as if I'd been using lots of quads and moving the camera.

And this is where I fail, I can't get the texture matrix to produce the same results as I would have gotten from using lots of world space positioned grass quads. Can you see what I'm trying to do?

Share this post


Link to post
Share on other sites

This topic is 3735 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.

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