PDA

View Full Version : object movement



drakstalker
01-04-2002, 09:44 AM
I have drawn 2 triangles on my screen and have managed to get the rotating. How can I move them independently of each other. I.E While one triangle rotates use the arrow keys to move the second. I have managed to use the arrow keys to move them, but they both move instead of just one. Thanks in advance.

thebamaman
01-04-2002, 12:42 PM
That is what the Push/Pop Matrix functions are for:

glPushMatrix();
glRotatef(angle, x, y, z);
DrawTriangle();
glPopMatrix();
glPushMatrix();
glRotatef(other_angle, x, y, z);
DrawTriangle();
glPopMatrix();

This will isolate the transformations to each triangle.

Hope I helped.

[This message has been edited by thebamaman (edited 01-04-2002).]