CS 381  >  Assignment 1

CS 381, Fall 2003
Assignment 1

General Information

Questions

  1. Personal Information (no points for this section, but you still have to do it)
    1. What is your name? (Yup, that’s a tricky one.)
    2. If I e-mail you, what address should I use?
    3. What is a phone number you can be reached at? (I will not give this out to anyone, except as needed for official university business.)
    4. Which college CS and math courses have you taken so far? Which are you taking currently?
    5. Do you intend to do the programming assignments for this class on your own computer or in a lab?
    6. Is there anything else I should know about you?
  2. Running a 2-D Open GL/GLUT Program (8 pts)
    1. Compile and run the program sample2d.cpp from the course web page (requires C++ with Open GL and °GLUT; you may need to install the latter yourself). What does the program do? Give details: colors, shapes, etc. Hint: “It doesn’t do anything, because I couldn’t compile it” is not an acceptable answer.
    2. Find the command “glBegin(GL_LINE_STRIP);”, and replace it with “glBegin(GL_LINE);”. When you run the program, what is different? (Check both graphics and text output!)
    3. Modify the source code in some other (interesting?) way. The program should still compile and run, but may (or may not) produce errors. What modification did you make, and how did the program’s behavior change as a result?
    4. This program is put together differently from most C++ programs you have seen before. In particular, while the function “display” does much of the real work, there is no call to “display” anywhere in the program (really!). After examining the code, made an educated guess as to how “display” gets called.
  3. Running a 3-D Open GL/GLUT Program (8 pts)
    1. Compile and run the program sample3d.cpp from the course web page (requires C++ with Open GL and GLUT). What does the program do? Give details: colors, shapes, etc.
    2. Find and comment out the call to setmaterial_main. When you run the program, what is different? In your own words, what is the purpose of the function setmaterial_main? (In this and the following questions, restore the program to its original form before proceeding with the next question.)
    3. Find the command “glEnable(GL_LIGHTING);”, and replace it with “glDisable(GL_LIGHTING);”. When you run the program, what is different? Based on your observation, why is lighting very important in 3-D CG?
    4. Find the command “glEnable(GL_DEPTH_TEST);”, and replace it with “glDisable(GL_DEPTH_TEST);”. When you run the program, what is different? In your own words, what purpose does this command serve? (Hint: Documentation is available. Use it!)
  4. From the Readings/Lectures (9 pts)
    1. Briefly describe the pen/plotter model for specifying graphics.
    2. Different types of hardware are needed for efficient implementation of the front-end (vertex) portion of graphics processing and the back-end (fragment/pixel) portion. Explain the two different types of hardware and the reason each is necessary.
    3. Perform the following linear interpolations.
      1. A certain value is 5.2 when t = 0 and 8.7 when t = 1. Using linear interpolation, approximate the value when t = 0.3.
      2. A certain value is 3.1 when x = 3 and 2.0 when x = 8. Using linear interpolation, approximate the value when x = 5.2.

Note

On the course information handout, it says that students must do something extra to receive full credit for a programming assignment. But since this is not a programming assignment, that policy does not apply here.


CS 381, Fall 2003: Assignment 1 / Last update: 9 Sep 2003 / Glenn G. Chappell / ffggc@uaf.edu