Rotating about an object

Hi everybody!

How can I make a sphere rotate around another sphere? Thanks!

first, move the sphere’s center to the origin (that’s the sphere that you want to rotate around, not the sphere that you want to rotate), then do your rotation, then translate back to get the sphere’s center in its original location. in pseudocode, that would look something like the following:

Vector3 SphereCenter; //set to the appropriate value
//remember that in gl transformations are done in the opposite order that you specify them
glTranslatef(SphereCenter);
glRotatef(rotation params);
glTranslatef(-SphereCenter);

[This message has been edited by SThomas (edited 06-01-2003).]