hi all,
just started doing opengl and i have a problem, i am doing the solar system project from the “Red Book” and i have come across a problem. I have added a planet and a moon but now i want to be able to add another planet which rotates around the sun, the code is below
glPushMatrix();
//sun and earth
sun();
glRotatef ((GLfloat) year, 0.0, 0.0, 1.0);
glTranslatef (2.0, 0.0, 0.0);
glRotatef ((GLfloat) day, 0.0, 0.0, 1.0);
earth();// draw earth
glTranslatef (0.5, 0.0, 0.0);
glRotatef ((GLfloat) day, 0.0, 0.0, 1.0);
moon();//draw moon
glTranslatef (0.5, 0.0, 0.0);
glRotatef ((GLfloat) year, 0.0, 0.0, 1.0);
mars(); //draw mars
glPopMatrix();
i cannot get it to go back to the origin, the sun, can anyone give a help please
cheers