PDA

View Full Version : Rotation Origin



Oynx
07-03-2001, 02:01 AM
Hi everyone,

I managed to fix my last problem by using fixed camera positions (thanks for all your help btw http://www.opengl.org/discussion_boards/ubb/smile.gif). The next problem is to do with the origin of rotation. Normally it is fixed at the centre of my model and I use gluLookAt to allow you to zoom in and out and glRotate to let you spin the model.

e.g.

gluLookAt( 0.0f, 0.0f, -m_dZoom,
0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f);
glRotatef(yRot, 1.0f, 0.0f, 0.0f);
glRotatef(xRot, 0.0f, 1.0f, 0.0f);


The problem I have is that I want to be able to change the rotation origin to another place in my model at request. Can anyone help me with the code?

Oynx
07-03-2001, 02:43 AM
*laughs his arse off!* I've worked it out now. You simply translate before you draw the model to effectively move the origin of rotation!