Assignment 2: Push and Pop to Save the Teapot
CS 445 /
645 Introduction to Computer Graphics
Fall 2001
Due: 5:00
Tuesday, October 2nd
This assignment is intended to familiarize you with the basic geometric transformations in OpenGL. In particular, you will have to utilize the translate, rotate, push, and pop commands to create an animation. We are providing you with the skeleton code, model primitives, textures, and camera motion for this assignment and all you have to do is put the parts in the right places. Build on the OpenGL/glut infrastructure you put in place for Assignment 1. You can use Unix, Linux, or Visual Studio to develop your system, but do not use any machine specific libraries (like the win32 API). For example, you should not have to include “windows.h” to compile your program.
The skeleton code (http://www.cs.virginia.edu/~gfx/Courses/2001/Intro.fall.01/Exercises/Exercise2) gets you started by providing models for a ground plane, a fire truck wheel, a fire truck body, and a fire truck ladder. You should run the skeleton code and watch what happens. You should see the body of the truck (and maybe some parts of the other models poking through it) slide down the road towards the teapot and stop. The camera will then sweep around the truck. During this period while the camera is sweeping behind the truck, the lower section of the truck's ladder will be swinging towards the teapot, both twisting and raising. Once the lower portion of the ladder is in place, the upper portion of the ladder will extend towards the spout of the teapot. The animation will then cease to change. Note we've included an object loader (so you can build objects in 3D modeling and CAD packages) and a texture map loader. You should look at how these components work because you'll have to manage the texture maps and object loading yourself in the future.
You should also view the sample animation of a working system: (http://www.cs.virginia.edu/~gfx/Courses/2001/Intro.fall.01/Exercises/Exercise2/index.htm).
1: (10 points) Translate the truck upwards so the wheels fit snugly beneath it and nothing goes through the ground.
2: (10 points) Position the four wheels in the correct places (make sure the texture map faces outward).
3: (20 points) Rotate the four tires according to the translation of the truck. Accurately compute the circumference of the tires and the translation of the truck for this.
4: (10 points) Put the lower ladder on top of the truck. It should be horizontal, with one end near the back of the truck. A second ladder should be placed on top of this first ladder. I don't care exactly where you put the ladders (I care more about how their rotation looks).
5: (30 points) When the truck comes to a stop ('at_fire' flag will be set to '1') you should begin to rotate the lower portion of the ladder (and the upper portion will move with it). The rotation should occur in small steps over a few seconds. It should simultaneously swing about the y-axis (up-axis)90 degrees towards the teapot and about the z-axis (depth-axis) 45 degrees towards the spout. The rotation about the y-axis should be incremented by 0.5 degrees per draw cycle. The rotation about the z-axis should be incremented by 0.25 degrees per draw cycle. These rotations should take place about the end of the lower ladder near the back of the truck. Imagine the very bottom of the lower ladder were attached to the truck by a hinge.
6:
(10 points) After the lower ladder has completed its rotations, the upper
portion of the ladder should slide upwards. It should translate 0.05 units
per draw cycle. The upper ladder should stop translating somewhere near
when it reaches the tip of the lower ladder.
7: (10
points) Perform the following procedures to turn in your code:
2.
Hit (9) to escape to unix shell
3.
type: cd /courses/cs/445_ brogan/Students/<username>
6.
In your directory, create a subdirectory named “Exercise2” where
you will put all your source files, binary files, texture maps, and project/make files.
7.
type: exit
You can either access this
directory via ftp, by home directory service, or through UNIX NFS (/courses).
Remember, we will be using the
‘date’ on each file to verify that you turned it in by the due date. Do not ‘touch’ any of your files in this
turnin directory after the turnin date
or you may lose a late day.
Hints,
Code, and Setup
The glut.h file and glut libraries: http://www.opengl.org/developers/documentation/glut.html
OpenGL (normally included with OS):
http://www.opengl.org/users/downloads
Collaboration and Use of Materials on the Web
You can use any materials you find on the web for this assignment.
You can talk with one another about your program, but do not look at anyone’s code and do not show your code to anyone.