CS 381  >  Week 4 Review Problems

CS 381, Fall 2003
Week 4 Review Problems

This is the last of the review problems for Test 1. See Test 1 Information and Week 3 Review Problems for more information about the test.

Below are some problems related to the material covered in class recently. Answers are in the Answers section, below. Do not turn these in. We may certainly discuss any of these problems in class, if you want.

You can expect Test 1 (on Friday, October 3) to contain problems similar to some of these.

Problems

  1. a. In the context of CG, what does “2 1/2-dimensional” mean? b. What is the quintessential example of a 2 1/2-dimensional interface?
     
  2. What is “picking”?
     
  3. Picking is used when clicking and dragging on windows. List two other GUI contexts where picking is used.
     
  4. What key fact about the geometry rendering pipeline makes picking difficult in a pipeline context?
     
  5. Roughly speaking, what does “extent” mean?
     
  6. Briefly describe each of the three picking methods discussed in class.
     
  7. Some picking methods may require us to draw the scene in an unusual way (for example, in unusual colors). We generally want to be able to do picking without the user seeing any odd rendering of the scene. What simple trick allows us to do this (in OpenGL, at least)?
     
  8. a. What, in general, does glReadPixels do? b. How is glReadPixels relevant to the topic of picking?
     
  9. What sort of shape is generally considered to be the easiest to do extent testing with? Hint: What sort of shape is just about every object in a typical GUI?
     
  10. We can use glReadBuffer(GL_BACK) to tell OpenGL that subsequent buffer-reading commands are to read the back buffer. Why (in the context of picking) would we want to do this?
     
  11. In CG, what is a “fragment”?
     
  12. Briefly describe the three main parts of the OpenGL geometry rendering pipeline, as they were described in class.
     
  13. What is “rasterization”?
     
  14. Is every fragment generated during rasterization necessarily written to the color buffer? Why or why not?
     
  15. In OpenGL polygons can be rendered with different colors specified at different vertices. What is the usual way of determining the color of the interior of the polygon?
     

Answers

    1. 2 1/2-dimensional interfaces are those in which there is no actual depth, but objects do have front-back relationships, so that some can appear to be in front of others. Thus, 2 1/2-D lies between 2-D and 3-D. (2-dimensional interfaces only have x- and y-coordinates; there is no depth or front-back relationship among objects. 3-dimensional interfaces have depth (z) so that objects can be (or appear to be) at varying distances from the user.)
    2. The quintessential 2 1/2-D interface idea is overlapping windows.
  1. Picking is the process of determining which of a number of objects or regions has been selected by a pointing device.
  2. Here are five possible answers. Picking is used ...
  3. Simply put, picking is difficult because the pipeline does not run backwards. The task of the pipeline is to translate geometric primitives into pixels (screen locations). Picking is (roughly) the reverse of this, but the pipeline model does not provide facilities for such backwards processing.
  4. The extent of an object is the region on the screen on which the object appears. The term is sometimes used (as in the text) for the smallest screen-aligned rectangle enclosing the pixels that show the object.
  5. The solution is to draw the scene off-screen and never transfer it to the screen. In OpenGL, we can accomplish this by drawing into the back buffer (which we usually do anyway), but not doing a buffer swap.
    1. Function glReadPixels reads a portion of an OpenGL buffer and stores it (as a raster image) in an application-provided array.
    2. We can use glReadPixels to help implement the buffer-reading picking method, where we draw the scene so that each object is a different solid color, and read the color of the pixel at the mouse position to determine which object was clicked on.
  6. The nicest shape for extent testing is a screen-aligned rectangle, that is, a rectangle whose sides are parallel to the sides of the frame buffer.
  7. Reading the back buffer allows a clean implementation of the buffer-reading method of picking. We draw the scene so that each object is a different solid color, then read the pixel at the mouse position. The given commands allows us to do this entirely in the back buffer, so that the user never needs to see a strange-looking variation of the scene.
  8. A fragment is “a pixel before it becomes a pixel”. A fragment has a screen location and a color (and possibly other information), but has not yet made it to the frame buffer.
  9. The three main parts of the geometry rendering pipeline are:
  10. Rasterization is the process of generating fragments from a primitive. A primitive may be something like a triangle. In order for the triangle to be drawn in the frame buffer, we must know which pixels to set to which colors. This information is provided by generating a fragment for each pixel we might set in the frame buffer.
  11. No, some fragments may not be written to a color buffer, because they may be discarded in the fragment operations. A common reason for this to happen would be failing the depth test. (Essentially, if a fragment lies behind an object that has already been rendered, then the fragment is thrown out.)
  12. The color of an interior fragment is generally determined by lirping the colors specified for the vertices. Specifically, the default algorithm lirps along the edges of the polygon, then lirps again along each scan line.


CS 381, Fall 2003: Week 4 Review Problems / Last update: 1 Oct 2002 / Glenn G. Chappell / ffggc@uaf.edu