PDA

View Full Version : Rotate a globe sphere with cursor keys



Puma1140
12-13-2003, 01:38 PM
How can we rotate a globe sphere with cursor keys? I tried:

glRotatef(rotx,1.0f,0.0f,0.0f,);
glRotatef(roty,0.0f,1.0f,0.0f);

and increased/decreased the variables rotx,roty but when I rotate the sphere around x axis and then around y axis, the result isn't the one i want

Bob
12-13-2003, 02:05 PM
...the result isn't the one i want

Then what do you want?

Puma1140
12-13-2003, 02:48 PM
It seems that when the angle rotx is not 0, when I try to rotate the sphere around y axis, it's rotating around x axis too(although it's not)...I want to rotate the sphere only left and right...do I have to use gluLookAt instead of glRotatef?

nexusone
12-13-2003, 07:52 PM
Have you tried using the Z axia in place or X or Y?



Originally posted by Puma1140:
It seems that when the angle rotx is not 0, when I try to rotate the sphere around y axis, it's rotating around x axis too(although it's not)...I want to rotate the sphere only left and right...do I have to use gluLookAt instead of glRotatef?

cwc36
12-13-2003, 10:21 PM
Hi,

You need to set flags for that.


if(ROTX_FLAG == true)
{
glRotatef(rotx,1,0,0);
}
if(ROTY_FLAG ==true)
{
glRotatef(roty,0,1,0);
}
Hope it can help.

Puma1140
12-14-2003, 04:33 AM
Unfortunately, this doesn't work either...

cwc36
12-14-2003, 07:12 PM
Hi,

What do you mean that is not work? What do you have currently? Could you rotate the object in x, y, z axis? Please confirm it first?

514VOID
12-14-2003, 09:24 PM
i sent a post to coding->advanced Moving camera position 12/12/2003 it will help