PDA

View Full Version : Sphere Rotation Problems

06-02-2003, 06:43 PM
Hi everyone.

I'm trying to get a sphere to orbit a bigger one, and it's not working. I'm using OpenGL in Delphi 7, and this is the code I'm using. If anyone knows what the problem is, could they let me know? Thanks.

glTranslatef(0.0,0.0,-6.0);
glRotatef(0.5,0.0,1.0,0.0);
glTranslatef(2.0,0.0,0.0);

glEnd();

06-02-2003, 06:44 PM
Also, many thanks to SThomas for trying to help me out before.

shinpaughp
06-02-2003, 07:14 PM
Originally posted by W. Poons:
Hi everyone.

I'm trying to get a sphere to orbit a bigger one, and it's not working. I'm using OpenGL in Delphi 7, and this is the code I'm using. If anyone knows what the problem is, could they let me know? Thanks.

glTranslatef(0.0,0.0,-6.0);
glRotatef(0.5,0.0,1.0,0.0);
glTranslatef(2.0,0.0,0.0);

glEnd();

Your glRotate function should pass a variable not 0.5 such that the variable is incremented by 0.5 or whatever value you want. Otherwise, it will be rotated at 0.5 degrees about the y axis but not consecutively and appear stationary.

glTranslatef(0.0,0.0,-6.0);
glRotatef(angle,0.0,1.0,0.0);
glTranslatef(2.0,0.0,0.0);

angle += 0.5;

beginner620824
06-02-2003, 09:31 PM
W.poons is right but he didn't write the actual code. it looks like:
while(1)
{
.........
rotate(angle,....);
angle+=whatever you want increase each loop;
}

Originally posted by W. Poons:
Hi everyone.

I'm trying to get a sphere to orbit a bigger one, and it's not working. I'm using OpenGL in Delphi 7, and this is the code I'm using. If anyone knows what the problem is, could they let me know? Thanks.