## 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.



1. _____/(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. _____/(2 points) What display technology depends on the ability of an electric field to straighten out a corkscrew molecule?

3. ________/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}$}

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

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

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

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

8. _____/2 What is the event loop?

9. _____/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?

10. ____/2 Since the routine specified in glutDisplayFunc takes no arguments, how do you get data from other routines to it?

11. _____/2 Give one disadvantage of standards.

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

13. ____/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?

14. ____/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);

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

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

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

18. ____/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?

19. ____/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.

20. ____/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.

end of exam