So, this is my problem. I should make a Solar System with the Sun in the center and the planets rotating around; each planet should have its own moons.
So, I did it all but I'm not able to do the Earth rotating on itself... The Earth rotates around the Sun, the Moon rotates around the Earth... How can I let the Earth rotating on itself? When I put another "glrotating" command inside the code, the Moon falls down the Earth or happens something strange...
Here follows my code...
// EARTH
// INFO: 1) it's 3rd planet from the Sun;
// 2) it's 5th largest planet in the Solar System, with an equatorial radius of 6378.388km;
// 3) it's 3rd fastest planet, because its orbital period is of 365 earth-days (1 year).
void Earth(void)
{
DrawOrbit(5.5, 1);
glRotatef((GLfloat) year*6.2, 0.0, 1.0, 0.0); //orbital movement for the Earth around the Sun
glTranslatef(5.5, 0.0, 0.0);
glColor3f(0.0, 0.3, 1.0);
glutSolidSphere(0.28, 20, 10); //draw Earth: more or less, the Earth has got the same dimension of Venus.
// The Earth has got one natural satellites: the Moon. Let's draw it:
glPushMatrix();
glRotatef((GLfloat) day*2, 0.0, 1.0, 0.0); //rotate for the moon
glTranslatef(0.5, 0.0, 0.0);
glColor3f(1.0f, 1.0f, 1.0f);
glutSolidSphere(0.05, 5, 4); //draw moon: its diameter is about a quarter the diameter of Earth
glPopMatrix();
}