- [4 points] What CMY color is equivalent to the RGB color (0.5, 0.2, 0.7)?
- [4 points] What is an appropriate glColor call for pure magenta?
- [4 points] List these colors in order of increasing apparent brightness:
Red, Yellow, Cyan, Blue
- [2 points] True or False: With appropriate adjustment, a color printer should be able to print an exact
visual duplicate of any image on a monitor.
- [4 points] Assume you have 3 variables Red, Green, and Blue,
representing a color, and their values are integers in the range 0 to 255.
Write the glColor3f call, and any additional code required, to set
this color. (You must use glColor3f.)
- [4 points] Assume you have the same variables as in the previous question.
Write some code that would set this color, not using glColor3f
(and not using glColor4f).
- [2 points] If a single pixel requires 4 bytes of memory, how much memory does a
graphics card need for a 1000 x 1000 pixel, double buffered display, without depth
buffering?
- [4 points] There's something wrong with the following line of code. Cross out
as much as necessary to make it make sense (and still work):
glutInitDisplayMode(GLUT_SINGLE | GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH)
- [6 points] If we wanted to create a program that rotates a 3D object whenever the user
moves the mouse while holding down the left button, and translates it when
the user moves the mouse while holding down the right button, which GLUT callback
functions need to be defined? (circle all that apply)
| glutKeyboardFunc
| glutMouseFunc
| glutSpecialFunc
|
| glutMotionFunc
| glutPassiveMotionFunc
| glutTabletFunc
|
- [4 points] Suppose we wanted to use a coordinate system different from the normal OpenGL
one:
Let the X axis point to the right, and the Y axis point forward (into the screen).
If this is a right-handed system, which direction will the Z axis point?
- [4 points] Write a gluOrtho2D call that will cause the triangle below to be
fully visible in the window:
- [4 points] If a program that calls gluPerspective(60, 1, 1, 100) produces the
image on the left,
what will it look like if we use gluPerspective(60, 3, 1, 100) instead
(assuming the window size does not change)?
Draw your answer in the window outline on the right.

- [6 points] Which argument, or arguments, in this function call must be changed to zoom in on a scene?
How must the value be changed (in a general sense, not an exact number)?
gluPerspective(45, 1.0, 0.1, 100)
- [4 points] How many glVertex calls are needed to draw this shape using GL_TRIANGLES?
- [4 points] How many glVertex calls are needed to draw the previous shape using a GL_TRIANGLE_STRIP?
- [4 points] Which of the following functions affect the drawing state? (circle all that apply)
| glBegin
| glEnd
| glTranslate
|
| glColor3f
| gluOrtho2D
| glVertex3f
|
- [8 points] If we have a function that draws a triangle as in the figure on the left,
what transformation calls should be added in order to draw the triangle as in the figure
on the right?
(Make sure you have the transformations in the right order.)

- [8 points] Why will nothing show up in the graphics window, when the following
drawing code is used, assuming the rest of the program is correct?
What should be done to fix it?
glMatrixMode(GL_PROJECTION)
glLoadIdentity()
gluPerspective(60, 1, 1, 100)
glMatrixMode(GL_MODELVIEW)
glClear(GL_COLOR_BUFFER_BIT)
glColor3f(1, 1, 0)
glBegin(GL_TRIANGLES)
glVertex2f(-1, -1)
glVertex2f(1, -1)
glVertex2f(0, 1)
glEnd()
glutSwapBuffers()
- [8 points] Cross out as many unnecessary lines of code as possible, without changing
what will be drawn by this code fragment:
glTranslatef(0, -3, 0)
glPushMatrix()
glBegin(GL_TRIANGLES)
glColor3f(1, 0, 0)
glVertex3f(0, 0, 0)
glColor3f(1, 0, 0)
glVertex3f(5, 0, 0)
glColor3f(1, 0, 0)
glVertex3f(2, 7, 1)
glColor3f(1, 0, 0)
glVertex3f(-3, 6, 1)
glEnd()
glPopMatrix()
- [8 points]
Assume the function drawSquare() draws a 2 x 2 square in the X/Y plane.
Sketch what will be drawn by the following code fragment, if
it is used in a program that sets up a depth-buffered, perspective display.
(use cross-hatching to represent the color red)
glLoadIdentity()
glTranslate(0, 0, -4)
glColor3f(1, 1, 1)
drawSquare()
glTranslate(1, 0, -4)
glColor3f(1, 0, 0)
drawSquare()
- [8 points] Sketch what the code in the previous question would draw, if used
in a program that sets up an orthographic display with no depth-buffering.