object movement

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.

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).]