View Full Version : Rotate orthographic projection scene

01-27-2010, 04:03 PM
I have a scene I'm creating with orthographic projection:

gl.glOrtho(0.0f, 100.0f, 0.0f, 100.0f, -1.0f, 1.0f);

I'm trying to rotate the scene 90 deg. counterclockwise using 'gluLookat()'. I can rotate the scene using 'glTranslate()' and 'glRotate()', but I'm thinking 'gluLookat()' would be better. Here's what I have working. I know this is Java, but I think the calls should be the same as C, eh?

gl.glTranslatef(100.0f, 0.0f, 0.0f);
gl.glRotatef(90, 0, 0, 1);

For the life of me I cannot get anything with 'gluLookat()' working. The basic (non-rotated) call to 'gluLookat()' is:

0.0f, 0.0f, 0.0f, // eye X,Y,Z
0.0f, 0.0f, -1.0f, // center X,Y,Z
0.0f, 1.0f, 0.0f); // up X,Y,Z

I can get the scene rotated correctly by specifying '1.0f, 0.0f, 0.0f' as the last three parameters, but I can't get the scene translated to the right any image is clipped off.....


01-27-2010, 07:11 PM
100.0f, 0.0f, 0.0f, // eye X,Y,Z
100.0f, 0.0f, -1.0f, // center X,Y,Z
0.0f, 1.0f, 0.0f); // up X,Y,Z

To Translate you need to move both the eye and the camera view point center by 100.

01-28-2010, 07:31 AM
Thanks for the response! It was close, but not quite. After rotating (e., setting the last three parameters to '1.0, 0.0, 0.0', 'up' is now the X axis so I need to move the eye and camera in the Y axis 100 units. The final call to do a 90 deg. counterclockwise rotation is:

0.0f, 100.0f, 0.0f, // eye X,Y,Z
0.0f, 100.0f, -1.0f, // center X,Y,Z
1.0f, 0.0f, 0.0f); // up X,Y,Z

Thanks again!