I’ve been started programming OpenGL 1 month ago, and there’s something I really can’t understand. Would you mind helping me answer them?
- Does gluLookAt modify the projection matrix? Or it really only deal with a series of translation and rotation?
I came to that question when trying to move the camera (view point, maybe?) around the scene.
- First, I set the camera at (2,2,2), point toward (0,0,0), up along y axis, using gluLookAt.
- Simply, I drew a 3D grid which I expected to be the world coordinates system’s representation.
- Then, when I use gluLookAt again to move the camera to (1.5,1.5,1.5) (everything else stay the same), and guess what? The 3D grid, instead of moving directly closer to me, move away, nearly out of the viewport! Ofcorse, when I use glLoadIdentity before using gluLookAt, things go fine! But why? I thought that the camera is descripted using world coordinates, and hence we do not need to load the identity matrix.
- Assume that we don’t have GLU library, and as I read in your book, there’s only one projection transformation function: glFrustum. If it’s so, then:
- Where’s the camera location in this function?
- If there’s no function to set up the camera location, then what can I do to view some object far away to the negative z axis? Assume that they’re so far that the view point must place behind the origin along the z axis! If only glFrustum can be use, how can I specify that camera location (view point)?