View Full Version : gluPerspective and gluLookAt help..

04-02-2010, 02:44 AM
If we ve set the camera position at (0,0,5) using gluLookAt and then we define our viewing volume in gluPerspective to be (1,10) as near and far values respectively .. does that mean the object within 1 unit and more than 10 units away from our current camera position is discarded .. ?? i.e are the near and far planes actually z=6 and z=15 ?? hope someone ll clear me on this.. thanks in advance..

04-02-2010, 08:18 AM
gluLookAt is typically used to adjust the modelview so that everything is moved in front of the camera. In OpenGL, camera space is pointing down the negative z axis. gluLookAt just spins the world around in front of the camera. The perspective projection happens in camera space, where it will clip at z=1 and z=10 (-1 and -10 actually).

For example, you use gluLookAt to set your camera at (0,0,5) looking down the negative z axis. A sphere is at the origin. In camera space, that sphere is moved to (0,0,-5) so it's sitting in front of the camera, which is now at the origin. Then you do that perspective projection there.