## ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Midterm Exam, Fall 2010




NAME: ____________________________________




EMAIL:___________________________ RIN:______________

14 Oct 2010 4-5:30

Answer every question.There are 5 pages with 22 questions, total 44 points.

For 2 questions, you may write free for your answer (and get 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.

1. _____/2 Why do we want to make projection into a matrix multiplication?
So we can combine it with all the other matrix operations (translation, rotation, scaling).
2. _____/2 Why does OpenGL contain primitives, like triangle strips, that are not necessary (since you could draw the triangles separately)?
It's more efficient since fewer vertices are needed than if you drew each triangle separately.
3. _____/2 What is the event loop?
It's what your OpenGL program transfers to as its last action. The loop then waits for inputs, such as mouse clicks. For each input, it calls the appropriate callback routine, if you've registered one. On its return, the loop waits for the next input, and repeats.
4. _____/2 What does this do:
glutDisplayFunc(display)
It registers the user routine display as the display callback.
5. _____/2 What does this do:
glMatrixMode(GL_PROJECTION);
Tells OpenGL the future matrix modification routines will modify the projection matrix (until glMatrixMode is called again).
6. ____/2 Since the mydisplay routine takes no arguments, how do you get data from the main program to it?
Global variables.
7. ____/2 What's the normal to the plane 5x+2y+3z=1? Your answer should be normalized.
Unnormalized: (5,2,3), but its length is {$\sqrt{38}$}. So, the normalized normal is {$\left( \frac{5}{\sqrt{38}}, \frac{2}{\sqrt{38}}, \frac{3}{\sqrt{38}} \right)$}
8. ____/2 Give 4 advantages of homogeneous coordinates.
Translation is a matrix multiply. So is projection. Points at {$\infty$} can be represented. All pairs of lines, even parallel, intersect. Therefore parallel and perspective projections are the same. When a curve is defined by control points, those points can be weighted individually. A circle can be exactly represented as a parametric homogeneous polynomial.
9. ____/2 What feature in OpenGL is used to display the closest object when several objects overlap the same pixel?
Z-buffer.
10. ____/2 Consider this sequence of calls:
glColor3f(1.,1.,1.);
glColor3f(0.,1.,0.);
glVertex3f(1.,1.,1.);
glVertex3f(2.,2.,2.);

1. What color is the vertex (1,1,1)?
green, i.e., (0,1,0).
2. What color is the vertex (2,2,2)?
green, i.e., (0,1,0).
11. ____/2 Give the 4x4 homogeneous matrix for a 90 degree rotation about the Y axis.
{$$M = \left(\begin{array}{cccc} 0 & 0 & \mathbf{1} & 0\\ 0 & 1 & 0 & 0\\ \mathbf{-1} & 0 & 0 & 0\\ 0 & 0 & 0 & 1\end{array} \right)$$}
12. ____/2 Since the Z buffer looks so useful, why is it not enabled by default?
Efficiency.
13. ____/2 Why do we like to group different physical input devices into the same logical input device?
If they provide the same type of input, then considering them as the same logical device is a reasonable level of abstraction. It matches how the user sees the system and how the system processes the data.
14. ____/2 Which one of the following code fragments would you be more likely to see? Why? Could the other one still be legal and generate a useful picture? Why?
1. this?
glMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_PROJECTION);
gluLookAt(1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0);
2. or this?
glMatrixMode(GL_PROJECTION);
glMatrixMode(GL_MODELVIEW);
gluLookAt(1.0,1.0,1.0,0.0,0.0,0.0,0.0,1.0,0.0);
This one because gluLookAt is usually used to change the modelview matrix. However the other one is still legal, and might generate a useful picture, for a sufficiently broad definition of useful.
15. ____/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 + dx
Y' = s Y + dy
I.e., tell me what s, dx, and dy are.
s=1/150, dx=0, dy=-1/2
16. ____/2 What's the 2 word name for the technique for storing the graphic objects in the GPU (if there's space) so that they does not have to be repeatedly sent down the network each time the window is redisplayed?
display list
17. ____/2 If you call glutCreateWindow a second time in the program, which one of the following happens?
1. a new window replaces the old one
2. a new window is created, and the old one still remains
3. nothing happens
4. an error message is printed and the program exits
5. the computer executes the HCF (halt and catch fire) machine instruction.
18. _____/2 What's the quaternion representing a rotation of 180 degrees about the axis (1,0,0)?
i
19. _____/2 Use the vector formulation to rotate the point (0,1,0) by 180 degrees about the axis (1,0,0).
{$p'= p \cos \theta + (a \cdot p)\, a (1-\cos \theta) + (a \times p) \,\sin \theta$} = p 0 + 0 (1,0,0) 1 + (0,0,1) = (0,0,1)
20. _____/2 What 3 simpler operations would you combine to rotate an object by 90 degrees around the point (1,2,3) about the axis (1,0,0)? That is, the axis does not go through the origin, but goes through the point (1,2,3).
Translate by (-1,-2,-3). Rotate by 90 about (1,0,0). Translate by (1,2,3).
21. _____/2 Find the equation of the plane through the 3 points (0,0,0), (1,0,0), and (0,1,0). Put your answer in the form ax+by+cz+d=0.
0x+0y+z+0=0
22. _____/2 What special considerations arise when the center of a projection is on the projection plane?
This is degenerate and can't be done since divisions by zero would happen.

end of exam