Computer Science 4160 - Computer Graphics
Assignment 1
Spring 2008

Transformations

Due February 14, 11:59pm

Purpose

This assignment was designed with 2 main goals: This assignment also gives you a chance to play around a little and explore. In particular, the assignment skeleton is written in OpenGL. While not absolutely required for this assignment, it would help for later assignments (which will require extensive use of OpenGL) if you could at least understand the framework (we'll discuss this briefly in class) and you may also want to play around with it a little. However, do note the submission requirements to not submit any modifications to the main assignment framework.

General Information

This assignment will ask you to fill in the code to allow rotation of the viewpoint around a scene.

Post any questions you have to the newsgroup. Other students will want to see the answers too. Do not post anything resembling code.

Getting started

This assignment is only supported for windows. Specifically, it was created with C++ Visual Studio 6.0. Try to get access to a computer with this software. If you plan to use UNIX, start early so you have time to contact the system administrator about problems you encounter (such as setting up glut, or finding the directory where gl.h is located).
  1. You probably already have openGL set up on your computer. Search for gl.h to see if you have it. If not, go to www.opengl.org and follow the instructions on downloading the appropriate files.
  2. You probably don't already have Glut set up. If you want, you can also find the download for that package from www.opengl.org. Alternatively, you can download the three necessary files from glut.zip. You will have to set up your path to point to the location of the dll. Note that some people have had problems compiling the skeleton with the new glut version. The one in the zip file should work.
  3. Download the assignment: HW1: Transformations.
  4. Unzip hw1.zip.
  5. Run hw1_solution_v2.exe. If you get an error message about glut32.dll, try adjusting your path, or simply copying it into the same directory.
  6. Compile and run the files as is.
  7. You should see the same teapot on a blue background, but the arrow keys won't work. Your job will be to make them work.

ONLY MAKE CHANGES TO Transform.cpp. Do not add any #include lines to the code. Do not change Transform.h. If you do make changes to any of the other files, make sure your solution works without those changes. You will only be submitting Transform.cpp.

The files nv_mathdecl.h, nv_algebra.cpp, nv_math.h and nv_algebra.h are provided as helper files. Don't worry about the details of these files. Concentrate on main.cpp. That said, You will probably have a much easier time if you look at set_rot().

Details

You will be implementing a classic crystal ball interface. This simulates a world in which the viewer is glued to the outside of a transparent sphere, looking in. The sphere is centered at the origin, and that is the direction towards which your eye is always pointing. At the origin, there is something interesting to look at -- in this case, a teapot.

You can change the viewpoint by rotating the crystal ball in any direction about the origin. Usually this is done with a mouse, but you will be using the keyboard for this assignment to make things easier. You must think about how the position of the eye and direction of the up vector change with left-right or up-down rotations.

Fill in the parts of Transform.cpp that say "//FILL IN YOUR CODE HERE". First, you should fill in left() and up(). Once these are working, fill in lookAt().

The compiled correct solution has been provided for you. Your solution must behave identically to hw1_solution_v2.exe. All you need to test this is to press the arrow keys a few times and toggle 'g' to make sure your lookAt() works.

You should play around with the solution to try and make the red and blue light line up by updating one and not the other (press 'h' when the solution is running). Also, you will have to answer a question in the submission email (see below).

Submission

You may submit more than once. Only the last submission will be graded.

When you are satisfied with you results, submit via email as described below:
To: cs4160@lists.cs.columbia.edu
From: [you]
Subject: HW1 - [your name]
Attachment: Tranform.cpp (do not include it as text. Make sure it's a separate file attachment.)
Body: Your name and email.
Describe why it is that the red light seems to provide more than just a point light source, illuminating the entire half of the teapot, while the blue light leaves most of the teapot dark, only illuminating as a point source. The answer can be found in the red book (Woo 3rd Ed.), on page 189 (4th ed, 5th ed, 6th ed = 195).

If you did not use Visual Studio on a Windows platform, please describe what you did to complete this assignment.

Documentation and Hints

We include below some optional documentation and hints that may be of interest. You are not required to use or refer to any of the material here, however. This mainly pertains to the material needed in tranform.cpp Main.cpp is not very well documented; one goal is for you to try to learn some OpenGL if you want to look at it in more detail.

FAQ