PDA

View Full Version : Solar System Rotation/Translation



carden2
03-17-2013, 03:14 PM
I need to get the moon to rotate around the earth. For some reason my earth is showing up but I am having troubles with the moon. I used the parameters given to me. It's suppose to be a solar system where earth is the sun (technically) then I'll have to work mars into the code and have it rotate around the sun which will rotate around earth. Any help would be appreciated. Either example code or reference material or if anyone could explain where I am going wrong it'd be greatly appreciated.

Thanks.



glMaterialfv(GL_FRONT, GL_SPECULAR,earthSpecRef);
glPushMatrix();
glColor3f(0,0,1);
gluSphere(planetQuad,EARTH_RADIUS,100,100);
glPopMatrix();

glPushMatrix;
glColor3f(0.4,0.4,0.4);
glTranslatef(15,0,0);
glRotatef(.5*(1/.0748),0,0,1);
gluSphere(planetQuad,EARTH_RADIUS*2.5,100,100);
glPopMatrix;

carden2
03-17-2013, 03:24 PM
Mine actually works I had the moon so big it was blocking earth. lol. The moon just isn't moving very quickly which is something I'll need to figure out.