Skip to main content
GameDev.net gamedev.net
🔒 Locked

rotation order (using glRotatef function).

Started by tirnanog Oct 13, 2005 at 3:54 PM 0 replies 1.3k views
Original Post
tirnanog
tirnanog
i've been trying (w/out success) to solve the following problem in the last two days. can some1 help me? i have a sphere that can be moved (using the arrows) on the x or z axis. i want the sphere also to have a suitable inner rotation while it's moving, and i'm using to glRotatef to do it. the problem is that when i first rotate the ball around the z axis (glrotatef(zrot,0,0,1) where zrot>0) - it changes the sphere axises, and therefore the rotation around the x axis that i do afterwards, don't work correctly (glrotatef(xrot,0,0,1)). in other words: the effect of the glrotatef around the x axis, will be different if i rotated or not the sphere around the z axis before. is there any way to solve it? maybe i need to use to rotatef function differently? or maybe i need to use some kind of matrix multiplication or something? thanks in advance!
WarMuuh
WarMuuh
ev after zrotation you can try to set the first "vector" of the actualy matrix to
1
0
0

and then rotate in x-axis but i have no idea if this works...;D

//edit:
or does this work:
glRotatef(zrot,0,0,1);
glRotatef(xrot,sin(zrot),cos(zrot),0);

[Edited by - WarMuuh on October 14, 2005 1:05:25 AM]

Topic Locked

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

Sign in to reply to this topic.