CG ECSE-4750 Computer Graphics Midterm, RPI, Thurs 2016-10-13

Name, RCSID:

.

.

Rules:

1. You have 60 minutes.
2. You may bring in one 2-sided 8.5"x11" paper with notes.
3. You may not share material with each other during the exam.
4. No collaboration or communication (except with the staff) is allowed.
5. There are 20 questions. Check that your copy of this test has all the pages.
1. (2 pts) If you wanted to change all the vertex positions by multiplying each x-coordinate by the same vertex's y-coordinate, the best place to do it is:

1. with a javascript function
4. in the html file
5. it can't be done.
.

.

2. (2 pts) Put these graphics pipeline components in the correct order:

2. primitive-assembly
3. rasterizer
.

.

.

.

4. (2 pts) If you do not tell OpenGL to do hidden surface removal, and two objects overlap the same pixel, then what color is that pixel?

1. OpenGL throws an error.
2. the closer object
3. the farther object
4. the first object to be drawn there
5. the last object to be drawn there
.

.

5. (2 pts) If i and j are quaternions, what is (i+j)(1+j)?

.

.

6. (2 pts) Adding (1+2i) to the complex representation of the point (x,y) is equivalent to doing what to it?

.

.

7. (2 pts) What is the quaternion for the rotation around the axis $\left(\frac{3}{13}, \frac{4}{13}, \frac{12}{13}\right)$ by 180 degrees?

.

.

8. (2 pts) How would you best send the location of a global light source to the vertex shader?

1. as a varying variable.
2. as a uniform variable.
3. in another array similar to the vertex array.
4. with a bindBuffer call.
5. as an attribute.
.

.

9. (2 pts) Why can the following not possibly be a 3D Cartesian rotation matrix?

$\begin{pmatrix} 1& 0 &1\\1 & 0 &0\\0& 0 &1\end{pmatrix}$

.

.

10. (2 pts) Name the 2 types of shaders that every WebGL program must have.

.

.

11. (2 pts) What is the CIE chromaticity diagram good for?

.

.

.

.

13. (2 pts) What method of doing rotation suffers from gimbal lock?

.

.

14. (2 pts) Describe how to implement picking.

.

.

15. (2 pts) What is the purpose of gl-canvas in this line of code:

canvas = document.getElementById( "gl-canvas" );

.

.

16. (2 pts) What does this line of code do:

gl.viewport( 0, 0, canvas.width, canvas.height );

.

.

17. (2 pts) What does this line of code do:

window.requestAnimFrame(render);

.

.

18. (2 pts) Name 2 things that this does:

gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, iBuffer);

.

.

19. (2 pts) What is the purpose of vPosition in this line of code?

var vPosition = gl.getAttribLocation( program, "vPosition" );

.

.

20. (2 pts) Suppose that your vertex shader computed some property of each vertex and wanted the rasterizer to compute a weighted value of that property for each fragment. What type of variable would your vertex shader store that property in?

.

.

End of midterm