For this programming assignment, you will be given a sample OpenGL program: Robot.C (see additional links below). With this sample code and the Jim Blinn paper "Nested Transformations and Blobby Man" (handed out in class) you will be able to do the following tasks.
(20 pts) Implement the Blobby Man in OpenGL.
Use the Blinn paper to build Blobby Man using the nested transform tools found in OpenGL. Allow for the Blobby Man variables in your transformations. Please use the variables names given in Table 1 of the Blinn paper. You should use Glusphere.
2. (20
pts) Add keyboard inputs for the Blobby Man variables.
Take each variable in Table 1 and tie it to a keyboard key. Use upper and lower case keys to control increasing and decreasing angles respectively. Also make sure the ESC key is mapped to exit.
Exten q/Q
ROT a/A
BTWIS w/W
NOD e/E
NECK d/D
LHIP r/R
RHIP f/F
LOUT t/T
ROUT g/G
LTWIS y/Y
RTWIS h/H
LKNEE u/U
RKNEE j/J
LANKL i/I
RANKL k/K
LSID o/O
RSID l/L
LSHOU z/Z
RSHOU x/X
LATWIS c/C
RATWIS v/V
LELBO b/B
RELBO n/N
3. (20 pts) Add to Blobby a straw hat made of a GluCylinder and Gludisk.
The hat should sit
on his head and move with his head. The hat should
also be able to be picked up by the left or right hand and waved around.
This means that the hat gets transferred to a different part of the
nested transform based on whether it is on the head, right hand or left hand.
Use the 5 key to cause the transfer to the right hand, 6 key to
transfer to the left hand and the 7 key to put it back on the head. (Note that
the hands do not need to be near the head when the transter happens)
4. (20 pts) Add a variable output function.
Add the ability to
save the current variable set to a file. This should
be done so that a new file can be created and then several positions appended
to that file. This will allow an animation to be
built up in a manner very similar to the clay-mation technique.
Variables should
be saved in the order they are in Table 1, plus a variable for the hat
position. A '0' when attached to the head, a '1' when attached to the right
hand, and a '2' when attached to the left hand. This way each line
in this file weill represent a blobby position or frame in the animation.
Map “save current
position” to the space key. Pressing the space key the
first time should ask for an output file name. Every
press after that should append a new set of angles to the file.
Don’t forget to close the file on program exit.
5. (20
pts) Add the ability to read the Blobby Man variables from a file.
Here you should be
able to specify an input file and then have Blobby man execute the moves
described in the input file. This replay of positions
should allow for looping and Yo-Yo mode controlled by the users.
Bind the functions of read, loop, and yoyo to the 1, 2, 3 keys. Also
map the 4 key to stop the animations and the esc key to exit the program.
Pressing the 1 key
should cause the user to be prompted for an input filename.
Pressing the 2 key
should cause the data in the file to be played back from the top to the
bottom. When it reaches the last line of data it should pop back to the top
and start over. This is loop mode.
Pressing the 3 key should cause the
data in the file to be played back starting at the top and going to the
bottom. When the last position in the file is displayed you should
switch directions and then play back all the positions from the bottom to the
top. Again, reaching the top go back to the bottom. This is YoYo mode.
Note:
For advice on compiling on Windows see this FAQ by Brad
Chuminatto.
Files:
Unix.tar.gz robot.C, Makefile, and glut header and library for Linux and SunOS.
Makefile.sunos
Makefile.redhat
MSVC.zip
VC++ project version of the source.