Texture Matrix Problems

Started by
2 comments, last by MARS_999 16 years, 7 months ago
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!

@mikaelbauer

Super Sportmatchen - A retro multiplayer competitive sports game project!

Advertisement
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
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?

@mikaelbauer

Super Sportmatchen - A retro multiplayer competitive sports game project!

Why do you keep translating to the center? If you are just trying to have the illusion of movement? I am tired so if I misunderstood you, sorry.

This topic is closed to new replies.

Advertisement