CS 381, Fall 2007
HW #2
General Information
- Submit your solutions to the homework assignment to Blackboard by
midnight on Tuesday, September 25. Submit source, text and output
files only! No executables, project/workspace files, etc.
- Worth: 25 points.
Homework Policies
Questions (5 pts)
- The glBegin-style primitives all draw
points, lines, or polygons.
But OpenGL has other primitives.
What sorts of things do they draw?
- Why is it generally a good idea to post a redisplay event
(in GLUT, by calling glutPostRedisplay)
when the window contents need updating,
rather than calling the display function directly?
- List two issues that come up in 3-D CG
that do not come up (or are much simpler to deal with) in 2-D CG.
Program #1 (10 pts)
- Write a C++ program using OpenGL/GLUT that draws something.
- Your program must use all ten of the glBegin-style
OpenGL primitives.
- Your program must respond in some meaningful way to the keyboard.
- Do not make me work hard to figure out how your program is used; put some
simple documentation on the screen (in the text window, for example).
- Refer to intro2d.cpp for a simple program with
keyboard input.
Suggestions for Extra Credit
- Doing any one of the following is sufficient—but do them all if
you want!
- Add a more advanced OpenGL feature to your program.
For example, try learning about and implementing one of the following.
- line stipples
- polygon stipples
- polygon mode
- display lists (“call lists”)
- Have your program’s display change automatically,
without requiring user input.
- Draw text in your program’s (graphics) window.
- Have your program respond to the mouse in some interesting way.
Program #2 (5 pts)
- Exercise 2.6. Begin with a single equilateral triangle whose sides are
1.5 units in length. Generate a 4 level Koch snowflake by recursive
subdivision. Note that each line segment is divided into thirds and the middle
third is replaced by 2 sides of a new equilateral triangle which is 1/3
the size of the original.
Program #3 (5 pts)
- Exercise 2.15. Be sure to answer the question at the end of the exercise.
Note
- Particularly well-done programs may be demonstrated in class.
CS 381, Fall 2007: HW #2 /
Last update: 19 Sep 2007