Rotate orthographic projection scene

  2 posts   Feedicon  
Replies: 1 - Last Post: January 28, 2010 15:35
by: redBeard15
showing 1 - 2 of 2
 
Posted: January 28, 2010 02:43 by redBeard15
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.

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:

glu.gluLookAt(
    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 and image is clipped off.....

Thanks!
 
Posted: January 28, 2010 15:35 by redBeard15
Well, I figured this out (with some help from others). 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:
glu.gluLookAt(
    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
Replies: 1 - Last Post: January 28, 2010 15:35
by: redBeard15
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close