CSCE 4813 - Homework 2
Due Date - 11:59pm on Feb 4, 2010

1. Problem Statement:

This homework assignment has three tasks. The first two are intended to familiarize you with the OpenGL examples in the source directory. The third task is to convert your program from homework 1 to use OpenGL and display the geometric object you created.

Task 1: Login to one of the machines in the graphics lab (room 237) and download the Makefile, disk.c and cube.c files from the class website onto your machine run "make disk" and "make cube" to compile the OpenGL examples. Now run each of these programs. Hopefully you will see a graphics window. See what happens when you drag a corner to resize the graphics window. Take a look at the source code of "disk.c" to see if you can find the code that causes the changes you see.

Task 2: Take a look at the source code "cube.c". You will see that this program calls an "init" and "draw" function in the "main" function like the other examples in class. There is also a "cube" function that generates the six polygons that make up a cube. Modify this program to:

  1. change the colors of the cube faces to your favorite colors,
  2. change the size and positions of the cubes generated by the program, and
  3. change the GL_POLYGON's into GL_LINE_LOOP's to generate a wire-frame display of the objects.
Compile and test your modified "cube.c" program. Hopefully this will give you a better feel of how OpenGL programs work. Save your version of "cube.c" to submit with your homework on the due date.

Task 3: Convert your program from homework 1 into an OpenGL program that displays your geometric object. To do this, you need to call your object printing function inside "display" and change your printf calls into glVertex calls. Since you were not able to "see" your geometric object in homework 1, there may be errors in your original coordinate calculations. Correct these mistakes as needed.

2. Design:

The design portion of this programming project is relatively minor. Your primary tasks are to decide which OpenGL graphics primitives map best to your object (GL_POLYGON, GL_TRIANGLES, etc) and what colors to use to draw your objects.

3. Implementation:

Your primary implementation task is to covert "printf" commands into OpenGL function calls. You may also want to "repackage" some of your homework 1 code if it was not modular enough for this assignment (ie add functions for each object).

Students are always welcome (and even encouraged) to make use of the OpenGL sample programs on the class website as a starting point for their projects. The "cube.c" program is probably the closest to what you need to complete this assignment. In particular, there is some OpenGL code in the "init" function that sets up a side view of the cubes so we can see multiple faces. You are welcome to change the rotation axis and angle to get a better view of your objects.

4. Testing:

Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Save your testing output in text files for submission on the program due date.

5. Documentation:

When you have completed your program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate text file to be submitted electronically.

6. Project Submission:

In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to hand in your documentation, program, and testing files. You are welcome to use either the "submit" or the "file upload" method.

The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit (50% off if less than 24 hours late, no credit if more than 24 hours late), so hand in your best effort on the due date.

You should also PRINT a copy of these files and hand them into your instructor in the department office. Include a title page which has your name and uaid, and attach your hand written design notes from above.