CSCE 4813 - Homework 2
Due Date - 03/07/2011 at 11:59 PM

1. Problem Statement:

The focus of this programming project is user interaction and object manipulation using OpenGL callback functions. In the previous assignment you displayed several objects in fixed positions and then rotated the whole scene to see them from different viewpoints. Your objective in this assignment is to create a graphical interface that will allow users to select one of the objects, and then change the size or position of the object.

Before you can manipulate an object, you need to select it. There are some fancy features in OpenGL for object selection, but one simple approach is to create an array of objects, and use a keyboard commands to traverse this array. For example, you could use 'n' and 'p' to go to the next or previous object in the array, and wrap around as needed at the ends of the array. In order to let the user know which object has been selected, you need to display the object using different brightness or different colors.

In order to change the size or position of your objects, you need to create a data structure that contains the initial sizes (sx, sy, sz) and positions (px, py, pz) of all objects being displayed. Then you can use keyboard commands or mouse movements to change these six values. For example, the user could enter "size mode" by typing 's', and then you can decrease object size when they type in 'x', 'y', 'z', or increase object size when they type in 'X', 'Y', 'Z'. Similar interactions could be used to change the object position.

Using the mouse to change the size or position of objects requires some creative thinking because the mouse clicks only return the (x,y) location of the mouse to the callback function. One option would be to only change the (sx,sy) or (px,py) values. Another option would be to change all three values by the same amount based on the mouse movement. It is up to you to think of one way to use the mouse in your interface.

2. Design:

There are two primary design tasks: (1) selecting the data structure to store object information, and (2) deciding what keyboard commands and mouse operations to implement to allow the user to change the size or position of the object. Obviously, the best designs are those that are intuitive for users, so they do not need extensive training/documentation, but you also need to keep in mind how difficult different choices are to implement.

3. Implementation:

You can implement this program using either a bottom-up approach or a top-down approach. If you go for a bottom-up approach, start by creating basic functions and classes, and test theses functions using a simple main program that calls each method. When this is working, you can create the main program that uses these functions to solve the problem above.

If you go for a top-down approach, start by creating your main program that reads user input, and calls empty functions to pretend to solve the problem. Then add in the code for these functions one at a time. This way, you will get an idea of how the whole program will work before you dive into the details of implementing each method and class.

Regardless of which technique you choose to use, you should develop your code incrementally adding code, compiling, debugging, a little bit at a time. This way, you always have a program that "does something" even if it is not complete.

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. Try your program on 2-3 input documents, and save screen shots and/or 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 document 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 "submit" or "upload" your documentation, program, and testing files.

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 your next class or put it his mailbox in the department office. Please print and include a copy of the programming project evaluation form as the title page of your report.