Project 2

Show your understanding of projections and of coordinate transformations.

We assume you are using Windows 2000 with Visual C++ 6.0. For more information, please read the COEN290 Lab Page.

This project builds on the program you built in Lab 1. Download the new Lab 2 .zip from Make a directory called "Lab 2" and unpack this zip file in that directory; Then copy redraw.c from your lab 1 directory into the "lab 2" directory.

Go into the "Lab 2" folder. Double-click on lab2.dsw, or start Microsoft Visual Studio and click on the "File" menu and select "Open Workspace" and choose lab2.dsw. Click the "FileView" tab to the lower left, and then click with your right button on "Source Files", choose "Add Files to Folder" and select the "redraw.c" file from your lab 1.

Your assignment
Your assignment is to add projection and viewing code to the function maindraw and make your program animated.

For projection, use glOrtho or glFrustum or gluPerspective. Remember that you have to be in the PROJECTION matrix mode.

For viewing, use either gluLookAt or some combination of glTranslate and glRotate.

To add animation, tell GLUT that the "maindraw" function is also an "idle" function (look at the GLUT list of functions in the Angel book). You will need to change your viewing location, rotation angle, translation, or something based on time in order to animate, and you'll need to keep a global variable for that. You can either animate the eyepoint (around the table, for example), or animate the object you built on the table.

For extra credit, you can make your object bounce like it would in a cartoon. We mean it should go faster as it gets close to the table, then squish as it hits the table, then bounce back into the air, get slower, stop at some point, and then continue.

You can always do other wacky stuff we haven't mentioned for extra credit, too.

Remember that if you turn in a 100% program by the due date, but don't get extra credit working until afterwards, you can still get half of your extra credit up to a week after the due date. Check the COEN290 Lab Page for more information.

You can compile and run your program using the "Build" menu and the "Execute" option.

We have provided the GLUT keyboard callback in redraw.c. For extra credit, you can add a key to turn on and off wireframe mode. This is controlled by glPolygonMode.

We've created a version of lab2 as if we had completed the lab already.


You can download this program and run it. Make sure you download it into the same directory as the other lab 1 files, because it uses a DLL (shared library) that is in the .zip file.

Submitting your results
Mail your main.c and redraw.c file to Brad Grantham at by Wednesday night at 7 PM.