Pan & rotation center...

I’ll try to be clear:
I have a scene I want to rotate around its x and z axis. The center of this rotation must be the center of my window. And, I want to pan this center in my view.

I tried this:

glTranslatef(panX, panY, 0); // pan view
glRotatef(rotX, 1, 0, 0); // rotate x
glRotatef(rotZ, 0, 0, 1);
glTranslatef(-panX, -panY, 0);// move rotation center in order to rotate around the center of my view

This was one of my numerous tests but it is one of the best !
Can someone tell me how I can do this ?

thanks.

             David

As matrix operations are always calculated backwards, you have to reverse the order of your translate/rotate calls:

> glTranslatef(-panX, -panY, 0);// move
> glRotatef(rotX, 1, 0, 0); // rotate x
> glRotatef(rotZ, 0, 0, 1);
> glTranslatef(panX, panY, 0); // pan view

Hope this works!

[This message has been edited by Kilam Malik (edited 07-19-2000).]