BU CAS CS 480

Introduction to Computer Graphics

Spring 1996

Programming Assignment 1

Due before class on Tuesday, February 6


This programming assignment will get you started as an OpenGL programmer, while introducing you to basic concepts in interactive graphics programming. You will develop a polygon drawing tool that allows the user to draw, fill, and modify a polygon given mouse and keyboard input. Since this is the first assignment, code templates and example programs are provided.

The polygon editing tool must run on the SGI, therefore you will need to use one of the SGI workstations in the CGL cluster (unless you have access to an SGI workstation elsewhere).

Your program's source files are to be electronically submitted by using the submit program on cgl. The code you submit should conform with the program assignment guidelines.

Part of your grade for this programming assignment will be based on your giving a short demo (2-3 minutes) in the CGL cluster. You will be expected to talk about how your program works, and we will see how well your program performs on some test examples. A demo date for this assignment is not yet scheduled but will be announced in class this Thursday, January 30. You will be asked to sign up for a slot by next Thursday.

Start programming early.

Get Some Files

To help get you started, some source files and templates have been provided. Some basic graphics utilities and the polygon tool's main program are provided for you. So, before you begin programming, you will need to copy some files from the directory /usr2/cs480/courseware/p1 on the CGL cluster. These files are:

By copying the source files, you have almost everything you'll need to build your own polygon drawing program. You are expected to complete the program by providing two missing subroutines using the code templates and by adding new callbacks. There are comments in the two template files that will help guide you in writing your own subroutines.

Example Program

There is an example polygon drawing program poly included in the same directory as the source files. This example demonstrates how area fill works when the OpenGL general polygon capabilities are used. Notice that concave and self-intersecting polygons are not always correctly handled. General polygons must be subdivided into convex polygons in order for OpenGL to draw them correctly.

The Code You Write

You are expected to write two new routines based on the templates provided in the files wire.c and fill.c , in addition you add new functionality to the program.

Extra Credit

For extra credit, change your program to allow texture mapped area fill. You will find an example OpenGL program showing the use of texture mapping in /usr2/cs480/courseware/book/checker.c. Be sure to create your own texture.

The user should be able to toggle texture mapping on and off by using the T key.

It possible to make the texture stretch as you pull the polygon, or to make it stay fixed. It depends on what values you send into the CS480 class Home Page for links to online OpenGL documentation. The following is a partial list of OpenGL routines you will probably need to do the compulsory part of this assignment:

Hint 2: Example OpenGL Programs

Many example programs from The OpenGL Programming Guide (red book) are available on the CGL cluster in /usr2/cs480/courseware/book.

Hint 3:

There are copies of the The OpenGL Programming Guide (red book) available for loan in the CGL cluster technical consulting office.


Page Created: Jan 20, 1996 Last Modified: Jan 11, 1996 Maintained by: Stan Sclaroff