View Full Version : Does gluLookAt work with gluOrtho2D

07-23-2003, 08:28 AM
I am trying to create a camera that moves in 2D space along the x,y coordinates, will gluLookAt allow me to accomplish this, when I have gluOrtho2D projection?


07-23-2003, 10:21 AM
I don't see why not. Just make sure that the camera position and the target positions share the same X and Y coordinates so you are looking straight down.

However, you might as well just use your own calls to glTranslate and glRotate if you are only working in two dimensions.

07-23-2003, 10:25 AM
would the translatef and rotate the entire scene be more efficient than using a camera?

I have a really complex scene, and i need to track an object that moves around the scene, so that the object is always in view, and i was thinking have the camera move with it.

but i dont know if translating and rotateing the entire scene would be better

any ideas? thanks

07-23-2003, 11:48 PM
that is the same.
if you kwow the position of the object and its orientation (angle around the z axis), use glTranslate + glRotate.
if you don't have the angle but you have the direction vector (or velocity) of the object, then use gluLookAt.

the 2 methods will produce the same effect so use the one which match your already computed object/ship/... parameters.

07-30-2003, 08:40 AM
I know that gluLooakAt does work with glOrtho not sure about glOrtho2D though. I don't see a reason it shouldn't though.