ECSE-4750 Computer Graphics, Rensselaer Polytechnic Institute, Midterm exam solution

NAME: ______WRF______________________________

   EMAIL:__________________ RIN:______________


7 Oct 2009 4-5:30

Answer every question.There are 7 pages with 15 questions, total 22 points.

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 Processing objects 1-by-1 with a graphics pipeline has a major advantage and also a major disadvantage. Name them.
It's fast since several objects can be processed simultaneously at different stages of the pipeline. However, the objects cannot interact with each other (except via the Z-buffer).
2. _____/1 Why must you remove objects that are outside the view volume?
If they are behind the camera, they will still project onto the projection (viewing) plane and interfere with the visible objects.
3. _____/1 Suppose that you have 100 triangles that can be arranged into a triangle strip. How many vertices would you have to specify to OpenGL if you use the fact that they can be arranged into a triangle strip?
102 (3 for 1st triangle, 1 each for the others).
4. _____/1 Why do we consider color to have three dimensions, such as RGB? There are an infinite number of visible wavelengths.
The human eye can see 3 primary colors; it has 3 types of color receptors.
5. _____/1 What is the event loop?
The final thing your OpenGL program starts executing, which waits for a event, processes its callback, then goes back to waiting.
6. ____/1 What rendering technique handles reflections and refractions well?
raytracing
7. _____/1 What is the OpenGL name for a potential pixel?
fragment.
8. ____/2 What feature in OpenGL is used to display the closest object when several objects overlap the same pixel?
Z-buffer, aka depth buffer.
9. ____/2 Consider this sequence of calls:
glColor4f(1.,1.,0.,1.);
glColor4f(0.,1.,0.,.0);
glVertex2f(1., 1.);
glVertex2f(1., 2.);
Assuming that all the relevant OpenGL options have been enabled, what colors are the 2 vertices?
The 2nd glColor4f call supercedes the first. That sets the drawing color to be transparent. Therefore the background color will show through. If that hasn't been changed, it will be black.
10. ____/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);
glOrtho(2.0, 8.0, 0.0, 8.0, -0.5, 2.5);
2. or this?
glMatrixMode(GL_PROJECTION);
glMatrixMode(GL_MODELVIEW);
glOrtho(0.0, 8.0, 0.0, 8.0, -0.5, 2.5);
glOrtho is typically used to set the projection, and so the 1st code example is more common. However, the 2nd fragment would also produce a legal but different result, because glOrtho will just modify the ModelView matrix here.
11. ____/3 Assume that you have a model coordinate space with corners (100,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.
The input X range is 200 and the output 2, so X would scale by 1/200 1/100 if we ignored Y. For Y it's 100 and 1 giving 1/100. Coincidentally, they are the same. (Thanks, Greg.) To make the scaled object as large as possible w/o going outside the window, s=1/100.
The center of the input region is (200,150) and that maps to the center of the output region, (1,0.5). That gives dx=dy=-1, again, coincidentally the same.
12. ____/1 What's the 2 word name for the technique for storing the graphics on the graphics card (if there's space) so that it does not have to be repeatedly sent down the network each time the window is redisplayed?
display list.
13. ____/1 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 halts and catches fire.
a new window is created, and the old one still remains.
14. ____/2 Here's how picking might have been implemented: When you pick an object, the line number of the glBegin call to draw the closest object covering that pixel might be returned by the pick routine.
Why would this idea be inadequate?
That object might have been drawn several times, perhaps in a loop or as part of a hierarchy. You probably want to know which of those several instantiations was picked.
15. ____/1 In this code fragment
glGetFloatv(GL_POINT_SIZE_RANGE, pointsizes);
glGetFloatv(GL_POINT_SIZE_GRANULARITY, &pointstep);
why does only pointstep have an ampersand before it?
It's a scalar, the other an array. Both are returning values. That's the C semantics for returning values into a scalar and an array.