2 objects in harmony

I have 2 objects, that are defined in the two functions mybody() and orbit(). mybody() sits in the centre of the screen and rotates, while orbit() should orbit mybody(). My problem is that they don’t want to appear 2gether. heres the code snippet:

glLoadIdentity();
glTranslatef(0.0,0.0,-8.0);
glRotatef(spin,0.0,1.0,0.0);
mybody();

glTranslatef(5.0,0.0,-5.0);  
glRotatef(spin,5.0,4.0,3.0); 
orbit();

glutSwapBuffers();

}//end display()

cheers 4 any help
Jules

I think the other object is just being drawn off screen. When you translate it effects all objects after it, unless you push the matrix then it only effects the object between the push/pop. Right now your last object(orbit) is being tranlated by -12 on the z-axis.

Try this:

glLoadIdentity();

glPushMatrix();
glTranslatef(0.0,0.0,-8.0);  
glRotatef(spin,0.0,1.0,0.0); 
mybody();
glPopMatrix();

glPushMatrix();
glTranslatef(5.0,0.0,-5.0);  
glRotatef(spin,5.0,4.0,3.0); 
orbit();
glPopMatrix();

glutSwapBuffers();

}//end display()

Originally posted by Jules:
[b]I have 2 objects, that are defined in the two functions mybody() and orbit(). mybody() sits in the centre of the screen and rotates, while orbit() should orbit mybody(). My problem is that they don’t want to appear 2gether. heres the code snippet:

glLoadIdentity();
glTranslatef(0.0,0.0,-8.0);
glRotatef(spin,0.0,1.0,0.0);
mybody();

glTranslatef(5.0,0.0,-5.0);  
glRotatef(spin,5.0,4.0,3.0); 
orbit();
glutSwapBuffers();

}//end display()

cheers 4 any help
Jules[/b]