I want to rotate a gluSphere around a fixed point in a circular motion, like a planet going around the sun.
Would it be best to use glRotatef or glTranslate? If so, in which order should I call them?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll have to do a little of both:
gluSphereis ‘facing’ the fixed point, so that translating forward with respect to the sphere puts you closer to the center of its orbitglTranslatefthegluSphereforward to the point around which you want it to rotateglRotatefthe direction you want the sphere to orbitglTranslatefbackwards just as far as you went forwardThat way, your sphere stays the same distance from the center, but gets translated ‘around’ in a nice orbit.