CS160 Program 1: Images from Mathematical Functions
Due Wednesday, October 8, 2002 MIDNIGHT
Submit Prog1 Directory using CATS Submit Program
Objectives:
Become familiar with OpenGL at a very basic level.
Learn interaction handling with the Fltk GUI, and
two-dimensional drawing with Fltk.
Assignment:
- The files under the Handouts section of the class web page will be
the basis for your homework. You must expand on their
capabilities to fulfill the assignment. Solution programs
are also provided. (Note: the solution programs run
on the Suns in BE 105 and PCs.) You do not have to exactly
duplicate the solution for the assignment but it should be very similar,
and must implement the specifics below.
- This assignment is based on a paper by Karl Sims,
Artificial Evolution for Computer Graphics ,
Computer Graphics, 25(4), July, 1991, pp. 319-328. (You don't
have to read the paper or understand it to do this assignment.)
The basic idea is to associate mathematical functions with positions
in a graphics window, and use the value of the functions to color
an image. Functions such as x, sin(x), random(y), etc.
can be added and multiplied, etc. In Sims' paper, the images evolve
automatically over time, but ours will not.
-
For this assignment, you will create an Fltk menu that includes
a graphics window and some GUI (graphical user interface) widgets.
The graphics window will contain a grid of 50x50 cells, and each
cell will have a value stored which comes from the specified functions.
You only need store a scalar at each grid location, which will produce
a greyscale image.
-
Using Fltk, create GUI widgets that allow you to select
two of a group of functions, and to select how to combine them. Also
create a Render Image
button to draw the resulting image, and exit the program.
(See the posted solution.)
-
You will create the image by drawing a polygon for each grid cell,
such that the values and locations of the polygon vertices are taken
from the grid corners.
Good Programming Counts:
-
Remember to use the good programming practices that you learned in
101; it will make a difference in your scores. In particular,
keep the GUI and display routines in separate files, and separated
from files that are not related to displaying and interface items.
For example, do not make GUI calls in files not directly related
to the GUI, and do not make openGl calls in files other than
those displaying graphics.
-
Reread this assignment now and then to make sure you are fulfilling
all of the requirements.
-
Save yourself a great deal of misery by saving early versions of
your program in separate directories, so that you can back out
if your program deteriorates or you inadvertently hit "rm *".
Submit:
-
Submission must be done using
the submit utility from CATS. Run "quickhelp submit"
or "submit -m"
on a CATS machine to get more info on the submit command.
To submit the assignment, do the following:
- Create a DIRECTORY called "
prog1". It should
contain all the files required to make your program
compile/run.
- Run "
make clean" in the directory to ensure you
do not submit .o files or the compiled program, or you
will lose points for possibly over-filling the directory.
Also make sure you do not submit core files.
- From prog1's parent directory (if you are in the prog1
directory, type "
cd .."), tar the directory with
the command "tar cvf prog1.tar prog1".
I strongly suggest you also untar it (tar xvf prog1.tar) to check.
- Compress the tar file with the command
"
gzip prog1.tar". This will produce the file
"prog1.tar.gz" which you will submit.
- Submit prog1.tar.gz with the command
"
submit cmps160-jw.f03 prog1 prog1.tar.gz".
- Note that if you are using the PCs in BE 109, you have to copy
the directory to your CATs account before submitting.
Questions?:
E-mail
amin@cse.ucsc.edu and
wilhelms@cse.ucsc.edu