CS 381
>
Assignment 1
CS 381, Fall 2003
Assignment 1
General Information
- E-mail answers to the questions below to me at
ffggc@uaf.edu,
using the subject
"GA1".
(If you wish to discuss the assignment with
me via e-mail, use a different subject.)
- Be sure to include your name in your e-mail.
- Due: Monday, September 15 (any time).
Note: This due date is definite.
I suggest that you try to get this assignment done early,
since Assignment #2 will need to be due less than a week
after #1, in order to get us back on schedule.
- Worth: 25 points.
Questions
- Personal Information (no points for this section, but you still have to do it)
- What is your name? (Yup, that’s a tricky one.)
- If I e-mail you, what address should I use?
- 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.)
- Which college CS and math courses have you taken so far?
Which are you taking currently?
- Do you intend to do the programming assignments for this class
on your own computer or in a lab?
- Is there anything else I should know about you?
- Running a 2-D Open GL/GLUT Program (8 pts)
- 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.
- 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!)
- 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?
- 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.
- Running a 3-D Open GL/GLUT Program (8 pts)
- 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.
- 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.)
- 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?
- 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!)
- From the Readings/Lectures (9 pts)
- Briefly describe the pen/plotter model for specifying graphics.
- 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.
- Perform the following linear interpolations.
- 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.
- 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