DMS 423 Midterm Exam

Name:                                                                         

  1. [4 points] What RGB color is equivalent to the CMY color (0.5, 0.2, 0.7)?


  2. [4 points] Write an OpenGL command that will set the current drawing color to pure cyan.




  3. [4 points] Assume you have variables Red, Green, and Blue, representing a foreground color, and variables BG_Red, BG_Green, and BG_Blue, representing a background color; the values are all integers in the range 0 to 255. Write appropriate OpenGL calls to clear the screen to the background color.







  4. [4 points] Suppose you have a digitized video in the form of a sequence of images. The video is 5 seconds long, runs at 30 frames per second, and is 100 by 100 RGB pixels. How much memory does the raw, uncompressed video data require?






  5. [4 points] Suppose you have a single image that you wish to display with glDrawPixels, and can store it in either TIFF or JPEG format. If you choose TIFF, the data that you pass to glDrawPixels will be (choose one:)
    A) larger than it would be from a JPEG
    B) smaller than it would be from a JPEG
    C) the same size as from a JPEG


  6. [2 points]   True or False:      You can use both single buffering and double buffering in one window

  7. [2 points]   True or False:      You can use both single buffering and depth buffering in one window

  8. [2 points]   True or False:      You can use both double buffering and depth buffering in one window



  9. [4 points] The diagram at the right shows a square, in the world coordinate system, that will be drawn by a program.

    If the program opens a 300 by 300 pixel window, and calls
     gluOrtho2D(-15, 15, -20, 20)
    
    how large will the square appear in the window (how many pixels wide and how many pixels tall)?








  10. [4 points] The diagram at the right shows a set of objects, in the world coordinate system, that will be drawn by a program.

    Write a gluOrtho2D call that will make the circle and three of the triangles fully visible, but no part of the square.






  11. [8 points] If the drawing code below produces the image at the right, what should be changed and/or added to produce an image that is zoomed in on the triangle? Give the necessary OpenGL calls; the numeric arguments don't need to be exact - just indicate if a value increases or decreases, or is positive or negative.
    def draw():
    
      glClear(GL_COLOR_BUFFER_BIT)
    
      glMatrixMode(GL_PROJECTION)
    
      glLoadIdentity()
    
      gluPerspective(60, 1, 0.1, 100)
    
      glMatrixMode(GL_MODELVIEW)
    
      glLoadIdentity()
    
      drawShapes()
    
      glutSwapBuffers()
    











  12. [4 points] How many glVertex calls are needed to draw a shape with a pentagonal outline using GL_TRIANGLES?













    For the following 3 questions, if you use multiple transformations, remember to give them in the correct order.

  13. [4 points] If we have a function that draws a triangle as in the figure on the left, what transformation call or calls should be added in order to draw the triangle as in the figure on the right?








  14. [8 points] If we have a function that draws a triangle as in the figure on the left, what transformation call or calls should be added in order to draw the triangle as in the figure on the right?








  15. [8 points] If we have a function that draws a triangle as in the figure on the left, what transformation call or calls should be added in order to draw the triangle as in the figure on the right?












  16. [6 points] Remember that glPushMatrix() saves the current transformation on a stack, and glPopMatrix() takes a saved matrix off of the stack. If we have a program that hierarchically draws the objects for a character's upper body, shown below, and each function that draws an object calls glPushMatrix() at the beginning and glPopMatrix() at the end, what is the largest number of transformations that will be saved on the stack at any one time?








  17. [6 points] If OpenGL had no perspective projection (only orthographic), which of the following depth cues would be affected? Circle all that apply:
    occlusion linear perspective relative size
    relative height texture gradient shading
    aerial perspective accomodation motion parallax

  18. [6 points] Still assuming OpenGL had no perspective projection, of the depth cues you circled for the previous question, which could be "faked" using other OpenGL features? How?


























  19. [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, -10)
    glColor3f(1, 1, 1)
    drawSquare()
    glTranslate(-1, 0, 4)
    glColor3f(1, 0, 0)
    drawSquare()
    










  20. [8 points] For a rendered image to look correct, the field of view used in the perspective projection should be the same as the amount of the viewer's field of view that the image fills.
    If a program uses the projection gluPerspective(60, 1.333, 0.1, 100), and is displayed on an 6 foot tall screen, how far away should the viewer stand to get a correct perspective? (You can leave your answer in terms of a sin, cos, or tan function.)