
_____/2 Put these graphics pipeline components in the correct order:
 fragmentshader
 primitiveassembly
 rasterizer
 vertexshader
answer:
 vertexshader
 primitiveassembly
 rasterizer
 fragmentshader

_____/2 If you do not tell OpenGL to do hidden surface removal, and depth buffer is not in use, and two objects overlap the same pixel, then what color is that pixel?
 OpenGL throws an error.
 the closer object
 the farther object
 the first object to be drawn there
 the last object to be drawn there
answer:
 the last object to be drawn there

_____/2 What is the purpose of vNormaljs in this line of code?
var vNormaljs = gl.getAttribLocation( program, "vNormal" );
It's the name of a shader attribute variable. getAttribLocation returns its location.

_____/2 There is an aliasing problem when raytracing objects that are so small that one ray sent through the center of a pixel might go to the left of the object, and the next ray, through the center of the next pixel, go to its right. Give two ways to modify ray tracing to lessen this problem.
 randomize the position of the ray in each pixel.
 fire several rays through each pixel and average.

_____/2 Bezier curves do not generally go through the their control points, except for the first and last control points. It would be quite easy to design a curve fitting system so that the curve goes through all the control points. However the CAD community has decided that they don't want this. Why?
The curve will swing outside the control polygon by a nonintuitive amount.

_____/2 In a fragment shader, a sampler2D does something more than a simple array lookup like you have in most programming languages. What?
When the subscript is fractional, this will interpolate between the values of the adjacent texels.

_____/2 Tell me about view normalization. What is it? What is good about it?
Transforms the universe, including the object, clip region, and projection, to make the clip region a 2x2x2 cube and the projection (x,y,z) > (x,y,0).
Clipping and projection are now easier.

(2 pts) The last big update in the OpenGL standard removed many things from the standard. Name two things that we've discussed in class that we now have to implement ourselves if we wish to use.
Lighting. Fog. Etc.

_____/2 Consider this 2D homogeneous point: (2,3,4). Rotate it by 90 degrees. What is the resulting point, in a Cartesian representation?
Cart: (1/2, 3/4). Cart rotation matrix: (0, 1 ; 1, 0). Rotated point: (3/4, 1/2).

_____/2 What is the 3x3 2D homogeneous matrix for a rotation by 90 degrees?
(0, 1, 0 ; 1, 0, 0; 0, 0, 1)

_____/2 Compute the projection equations when the viewpoint is at (0,0,0) and the projection plane is x+2y+2z=4. Use Cartesian coordinates. You do not need to put the result into a matrix form, but simplify your result as much as possible.
Projected point is a scaled version of input point.
x' = x * 4/ (x+2y+2z)
y' = y * 4/ (x+2y+2z)
z' = z * 4/ (x+2y+2z)

_____/2 Using homogeneous coordinates for spline control points gives the designer an extra tool. What happens to the curve when the designer changes the weight in a homogeneous control point?
That attracts the nearby part of the curve closer to that point.

_____/2 Why are the Bresenham line and circle drawing algorithms less useful now?
Now, HW is faster and has floating point.

_____/2 In the graphics pipeline, when a triangle is processed, the (x,y,z) coordinates of the vertices are interpolated across the whole triangle to give the coordinates of each fragment. Name two other things that may commonly be specified at the vertices and then interpolated across the triangle to give a value for each fragment.
Normals, texture coordinates, colors.

_____/2 Given a=(3, 4, 5) compute a matrix M so that, for any p, (a ⋅ p) a = M p
Mij = ai*aj.
M = (9 12 15; 12 16 20; 15 20 25)

_____/2 Before memory was cheap enough for depth buffers to be practical, one hidden surface technique involved sorting the objects by distance and then drawing them into the color buffer backtofront.

Name this method.
Painters algorithm.

Describe one complexity with implementing it.
When 2 objects have close Z values, it's impossible to tell which to draw first. A really bad case is 3 interlocking objects.

_____/2 In a shader, what is the difference between a uniform variable and a varying variable?
Uniform: same value for all vertices. E.g., light position.
Varying: computed in vertex shader. Interpolated by rasterizer. Input to fragment shader. E.g. color.

_____/2 In this code to compute diffuse lighting:
float intensity = max(0.0, dot(N, normalize(L)));
where is the light source when max makes a difference?
Behind face.

_____/2 Given a sphere of radius one, what's the normal to the surface at the point (0,0,1)?
(0,0,1)

_____/2 3D clipping is usually implemented with six stages of a viewing pipeline. What are those 6 stages?
Clip against a top plane, bottom plane, front plane, back plane, left plane, then right plane. (Order doesn't matter).

_____/2 What causes some people to be tetrachromats?
Two different versions of the green cone, most sensitive to 2 different wavelengths, gene on two X chromosones.

_____/2 Give 2 reasons why we usually use a sequence of lowdegree curves instead of one high degree curve.
Local control.
More numerically stable (less roundoff error).
Curve is more intuitive  small control point changes don't cause big curve changes.

_____/2 What does the word rational mean in NURBS?
homogeneous.

_____/2 What might clipping do to the number of vertices?
 The number of vertices might stay the same or reduce but not grow.
 The number of vertices might stay the same or grow but not reduce.
 The number of vertices might stay the same or grow or reduce.
 The number of vertices must stay the same.
The number of vertices might stay the same or grow or reduce.

_____/2 What is the difference between Phong shading and Gouraud shading?
Phong: input: normal at each vertex. interpolate them for each fragment. compute lighting at each fragment.
Gouraud: input: normal at each vertex. compute lighting at each vertex. Or, input lighting at each vertex. interpolate lighting for each fragment.
Gouraud faster but not as realistic.

_____/2 What does it mean to separate the geometry from the topology when building a model?
geometry is the vertex position.
topology is which vertices define each edge and face.
separate means to store them in separate arrays. Each vertex is stored only once.

_____/2 Can the volume of a small cube change when its vertices are rotated? (yes or no). Why (not)?
No since lengths don't change since rotations are rigid.

_____/2 What does this do:
gl.vertexAttribPointer( vNormal, 3, gl.FLOAT, false, 0, 0 );
Tells GPU that the array of bytes storing the vertex normals
is to be interpreted as groups of 3 floats per normal.
vNormal is the address of the shader attribute variable for
the normal.

_____/2 What does this JS line do?
document.getElementById("ButtonX").onclick = function(){axis = xAxis;};
defines a callback for a button.

_____/2 Where is the 3D homogeneous1point (1,0,0,0)?
at infinity in the direction (1,0,0).