Sattinger's Law: It works better if you plug it in Concept 2.1 : The Viewing Transformation ====================================== Idea ==== The camera is positioned in OpenGL using the gluLookAt() command: gluLookAt(eyex, eyey, eyez, centerx, centery, centerz, upx, upy, upz); The first three specify the position of the camera, the next three the direction in which it is pointing, the last three define the up-vector In the default position the camera is at the origin, is looking down the negative z-axis (i.e. into the screen) and has the positive y-axis as straight up. Experiments: ============ 1) Try the following values for the parameters described above. a) gluLookAt(0.0, 3.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); b) gluLookAt(3.0, 3.0, 5.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0); c) gluLookAt(0.0, 0.0, 10.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0); The screen goes blank! Why? 2) Vary the parameters and reexecute the code. What is the color of the left face of the cube? 3) Vary the positions to see the color of the back of the cube. 4) Press the Reset button. Set the Up X, Up Y, and Up Z values as below. What happens and why? Up X = 1 Up Y = 1 Up Z = 0 Answers: ======== 1c) We see nothing, because the up vector is parallel to the viewing direction. Typically an upvector perpendicular to the viewing direction will work fine. 2) Green. Try gluLookAt(-4, 4, 5, 0, 0, 0, 0, 1, 0) 3) Red. Try gluLookAt(2, 2, -5, 0, 0, 0, 0, 1, 0) 4) Our image seems to be flipped by a 45 degree angle. Imagine that now we have a camera 10 units along the +ve Z direction, aimed at the orign, but the camera itself is tilted 45 degrees along the XY plane. Question: ========= If you were not allowed use the gluLookAt() utility could you use any other transformation commands instead? Hint: In the default positon the camera is at the origin looking down the negative z-axis. We shall answer this question in the next concept.