Hi,
I am developing an OpenGL graphics framework. It is such that I can add components to it which are in world coordinates. Now the problem is… When I rotate the entire model, the model rotates around the origin of the World coordinate i.e. around the first object added to the framework.
But I want the model to rotate around the center of the screen. I am a little confused about the orer of my translations and rotations. Can someone help me out here???
here is a snapshot of the code where I set my camera.
void UpdatecameraLocation()
{
// set the zooming factor
Graphics.Scale(zoom,zoom,1);
// move the eye to the new origin
Graphics.Translate(scaledOrigin.x*aspect_ratio, scaledOrigin.y, scaledOrigin.z);
// rotate the eye
Graphics.Rotate(rotation.x, rotation.y, 0);
}
I also want to pan the model left/right, up/down, so I need to take that into account as well. If I simply switch the translate and rotate call above, the model does rotate about the center of the screen but then it wont pan in the correct direction. e.g. when I have rotated the model by 90 degrees, it pans in and out of the screen instead of left and right.
Waiting for your replies…
Fastian
[This message has been edited by Fastian (edited 09-11-2001).]