Does gluLookAt work with gluOrtho2D

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?


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.

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

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.

I know that gluLooakAt does work with glOrtho not sure about glOrtho2D though. I don’t see a reason it shouldn’t though.