## ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Midterm Exam, Fall 2012, 11 Oct 2012 4-5:30

NAME: ____________________________________ EMAIL:___________________________ RIN:______________

Answer every question.There are 5 pages with 20 questions, each worth 2 points. You may write
*FREE* as the answer for two questions (and get the 2 points each).

This exam is open book: you may use calculators and any paper books and notes that you brought with you. You may not use computers or communication devices, or share material with other students.

- _____/(2 points) What does the following code do:
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0); glOrtho(-5.0, 5.0, -5.0, 5.0, 5.0, 100.0);

- _____/(2 points) What display technology depends on the ability of an
electric field to straighten out a corkscrew molecule?

- ________/2 Why can the following not possibly be a 3D Cartesian rotation
matrix?
{$ \begin{pmatrix} 1& 0 &0\\1 & 0 &0\\0& 0 &1\end{pmatrix} $}

- ________/2 If
*a=(1,2,3)*then write {$(a\cdot p)\, a$} as a matrix M, depending only on {$a$}, times {$p$}.

- ______/2 Can the volume of a small cube change when its vertices are rotated? (yes or no). Why (not)?

- _____/2 Why does OpenGL contain primitives, like triangle fans,
that are not necessary (since you could draw the triangles
separately)?

- _____/2 Why do we consider color to have three dimensions, such
as RGB? There are an infinite number of visible wavelengths.

- _____/2 What is the
*event loop*?

- _____/2 What is it about how display lists are constructed that prevents you from creating an infinite loop, where list 3 might call list 4 and list 4 calls list 3?

- ____/2 Since the routine specified in
`glutDisplayFunc`

takes no arguments, how do you get data from other routines to it?

- _____/2 Give one disadvantage of standards.

- ____/2 What's the dot product of these 2 vectors: (1,2,3), (4,5,6)?

- ____/2 One property of a well designed font is that different characters may have different widths. E.g.,
*m*is wider than*i*. This could be a problem when writing a character string in OpenGL since you'd have to know the width of each character and advance the raster position the correct amount after drawing each character. However OpenGL makes things easy for you. How?

- ____/2 What would look different in the resulting image if you changed the
*1.0*to*-1.0*in the following line?`gluLookAt(camera.getZoomDistance() * sin(camera.getViewDirection()*PI/180.0), 0.0, camera.getZoomDistance() * cos(camera.getViewDirection()*PI/180.0), 0.0, 0.0, 0.0, 0.0,`

**1.0**`, 0.0);`

- ____/2 What feature in OpenGL is used to display the closest object when several objects overlap the same pixel?

- ____/2 Give the 4x4 matrix for a 180 degree
rotation about the Z axis followed by a translation by (0,0,4).

- ____/2 Since the Z buffer looks so useful, why is it not enabled by default? Give 2 reasons.

- ____/2 When OpenGL calls a mouse or keyboard callback routine, there is a
small problem with the cursor coordinates that OpenGL passes to the
routine, if you wish to use the cursor location to draw something. What
is this problem?

- ____/2 Assume that you have a model coordinate space with corners (0,100)
and (300,200). You wish to map points in it to a rectangular window with
corners (0,0) and (2,1). The center of the model coordinate space must
map to the center of the window. X and Y must scale the same. The model
coordinate space must touch the opposite sides of the window in one
direction (x or y) and be inside the borders of the window in the other
direction (y or x).
Compute what the transformations for X and Y should be, in this form:
X' = s X + d
_{x}

Y' = s Y + d_{y}I.e., tell me what s, d_{x}, and d_{y}are.

- ____/2 If you call
*glutCreateWindow*a second time in the program, which one of the following happens?- a new window replaces the old one
- a new window is created, and the old one still remains
- nothing happens
- an error message is printed and the program exits
- the computer executes the HCF (halt and catch fire) machine instruction.

*end of exam*