0 Notes
CSI4130
Review Questions – Lecture 2 University of Ottawa – Universit ́e d’Ottawa
Jochen Lang
These questions are meant as a review of lecture material. The style of these questions is not necessarly a good indication of the style of the midterm (see the midterm examples instead).
1 Mouse Clicks
A line is defined by two mouse clicks in a GLUT application with (x, y) screen coordinates (10, 35) and (50,340), respectively. What are the coordinates of these clicks in the OpenGL canonical viewing volume? Assume the standard OpenGL viewing volume and a screen size of (640, 480).
2 Viewing Transformation
Anobjectislocatedatp=−1 −1 −6T withtheskyatz=+inf. Placethecameraat
c = 5 1 3 T looking at the object. Calculate the eye position and the coordinate frame basis vectors {u, v, w}. (Figure 1 shows the camera frame {u, v, w}).
Figure 1: OpenGL Camera Frame
1
3 Pojection Matrix
The OpenGL projection matrix in Equation 1 and the view planes n = −5, l = −3 and b = −1 are specified. The viewing volume has a depth d = 10, and a width w = 5 and height h = 5 at the near plane. Calculate (numbers!) the OpenGL projection matrix. Use it to map the point
a1 = 2 −1 −5 T and the point a2 = −9 12 −15 T into the canonical viewing volume, i.e., calculate (numbers!) the 3D cartesian coordinate (includes homogenization) of the point a1 and the point a2 in the canonical viewing volume.
2|n|0r+l 0
r−l r−l
0 2|n| t+b 0
t−b t−b
MOpenGLProjection = 0 0 |n|+|f| 2|f||n| . (1)
|n|−|f | |n|−|f | 0 0 −1 0
2