glLoadIdentity(); // clear matrix
for(x=0; x <10 ; x++)
{
glPushMatrix(); Save matrix
glTranslate( object[x].x, object[x].y, object[x].z); // Location on screen
draw_object( x );
glPopMatrix(); Restore Matrix
}
Now when use glTranslate it only effects the current object, the Push/pop matrix restores the matrix back each time.
Also with Push/Pop matrix you can stack them.
Lets say you have a moon orbiting around a planet, the moon is drawn relative to the planet.
//Draw planet with moon
glPushMatrix();
glTranslate(....); // location of planet
drawPlanet();
glPushMatrix() // Works with multiple moons too
glTranslate(...); // location of moon relative to planet.
drawMoon();
glPopMatrix();
glPushMatrix();