Silverman's Law: If Murphy's Law can go wrong, it will. Concept 3.3 : Perspective Projection - A call to glFrustum() ==================================== Idea ==== To define the projection (from a 3D world on to our computer screen) first the matrix mode is set with glMatrixMode(GL_PROJECTION) to be the projection mode. glFrustum() is used to specify the perspective projection viewing volume (Concept3.1) Window II shows the actual frustum used for viewing the cube rendered in the top window. Experiment: =========== a) Increase the near plane distance to 10. Can you explain this? b) Type in 14 as a value for Near Plane and explain the result. c) Lets try one more variation. Change Left to -5, Bottom to -1, Right to 5, and Top to 1. d) Try different values for the camera position in window I Answers ======= a) By increasing the near plane value to 10 from 2 we bring it 8 units closer to the object. Remember the Near Plane distance is measured from the view point. So now the object appears bigger. b) Now the near plane value is at -1. Our cube is rendered about the orign. So our frustum starts inside the cube and what we see is the back inside face of the cube ( in red) c) The cube gets elongated along the Y axis, because the frustum is expanded in the X direction and shrunk in the Y direction. Hence the screwed up aspect ratio. gluPerspective() ================= We end this module by briefly discussing gluPerspective() gluPerspective() is a library routine built on top of glFrustum() that is easier to use. gluPerspective( fovy, aspect, near, far ). 'fovy' is the angle at the apex along y-z plane and 'aspect' is the width / height of the rectangular top face of the frustum. 'near' and 'far' are as before. Note: ===== On the screen at the bottom use the (x,X), (y, Y), (z,Z) keys to navigate along the respective axes to view the frustum from different angles.