Skip to main content
gamedev.net
🔒 Locked

Need help - Rotation problem

Started by srky982 Mar 6, 2007 at 9:21 AM 6 replies 650+ views
Original Post
srky982
srky982
If i have 3 rotations: glRotatef(x,1.0f,0.0f,0.0f); glRotatef(y,0.0f,1.0f,0.0f); glRotatef(z,0.0f,0.0f,1.0f); Object(); 1.step x=90; 2.step z=90; but it wont be z-rotation because z axis is rotated by the first one. I save perspective with glPushMatrix() do glLoadidentity and recall it with glPopMatrix() but still it contains my first rotation.How to clean matrix after glPushMatrix and before glPopmatrix so it contains no rotation but contains perspective that i can recall. In fact i want to do a real z rotation after x rotation. Thanks!
srky982
srky982
I know that but i have all three in loop sometimes i need one sometimes another how to handle it?Can i do it by loading a new matrix (glLoadMatrix()) ?
srky982
srky982
Lets say:
a=0;
loop starts:
----------------------
if (a==1) rotatex(); -> LOOP
if (a==2) rotatey(); -> LOOP
----------------------
(a) become 1 so rotatex happened in loop.
But now (a) become 2 the second rotation hapened but it is not y rotation.Get it?
How to remove the first rotation from matrix,so the second one can be y rotation,but at the same time to save the first one?
srky982
srky982
Thanks a lot !!!
You just told me everything i hope to get.
Thanks really :)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.