CS 381, Fall 2007
HW #1
General Information
- Submit solutions of your homework to Blackboard by midnight
on Tuesday, Sep 18.
- Send an e-mail to me (ffmgr@uaf.edu) and provide me with your preferred
e-mail address for course-related messages.
- 20 points.
Questions
- Do you intend to do the programming assignments for this class
on your own computer or in a lab? Identify OS, processor, graphics card
and compiler if using your own system. (4 pts)
- 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!)