CS 381
>
Assignment 5
CS 381, Fall 2003
Assignment 5
General Information
- E-mail
answers to the questions and
C++ source for the program described below to me at
ffggc@uaf.edu,
using the subject
"GA5".
(If you wish to discuss the assignment with
me via e-mail, use a different subject.)
- If possible, please send your source as an attachment to your e-mail,
rather than as part of the body text.
- Send source only! No executables, project/workspace files, etc.
- Be sure to include your name in your e-mail.
- Due: Thursday, October 16 (any time).
- Worth: 30 points.
Homework Policies
See the
Homework Policies handout.
Questions (5 pts)
Note: If you see some strange symbols below,
it is because you are not using an HTML 4.01-compliant
browser.
In which case, go find one.
Since the 4.01 standard is over 5 years old, I don’t think this
is asking too much.
- Let u = (1, –1 ,2),
and let v = (0, 3 ,1).
Compute each of the following.
- 2u.
- u + v.
- u – v.
- u · v.
- u × v.
- Find the angle between u and v, in degrees,
to one decimal place.
Program (25 pts)
Write a C++ program using OpenGL/GLUT
that meets the following requirements.
- Your program must include at least two functional widgets.
- Your widgets must generally act the way widgets act in a modern GUI,
as in MS-Windows, MacOS, etc.
(If you think you can improve on these, go ahead.)
- In particular, your widgets must respond visibly to a mouse-down event
(i.e., a widget must change its appearance before the associated mouse-up).
- Widgets written for the purpose of this section of the assignment
may not use any pre-written GUI widget packages
(other than my Button package;
see below).
- Your program must provide documentation in either a graphics window or a pop-up menu,
as in
Assignment 4.
- As in previous assignments, your program must do something
User interface should have a purpose.
Sample Code
The Button widget class we discussed is now available.
Files are
button.h
and
button.cpp.
Also see
colorchange.cpp,
a program that uses the Button class.
Suggestions for Full Credit
Doing any one of the following is sufficient.
- Write a more complex widget,
for example, radio buttons,
a scroll bar or other “slider” widget,
or a menu pop-up.
- Write and use a “widget manager” class.
To get full credit, your manager should have the following features:
- Once a program contains a functional widget, adding a new widget should require only
declaring it, setting its properties, and telling the manager about it.
- You should be able to make widgets visible and invisible by telling the manager.
Invisible widgets should act as if they do not exist (i.e., no reponse to the mouse, keyboard, etc.).
- Write a button that not only functions as a button,
but can also be dragged to a new location.
- Add a more advanced OpenGL feature to your program.
For example, try learning about and implementing one of the following.
- point, line, or polygon smoothing
- blending
- GLU tesselators
- Evaluators
- Stenciling
- Drawing raster images
Do not expect full credit on two different assignments for the same advanced feature!
- Have your program do something practical.
You will need to explain to me why you think your program is practical.
- Make your program some kind of game, with scoring, rules, etc.
Note
Particularly well-done programs may be demonstrated in class.
CS 381, Fall 2003: Assignment 5 /
Last update: 20 Oct 2003 /
Glenn G. Chappell /
ffggc@uaf.edu