UW Graphics Group

CS 559: Computer Graphics
Fall 2001

CS 559 Home
Calendar Resources Assignments Projects 1 2 3  

Computer Graphics Programming Assignments

UPDATE 10/21/01 - You are not required to turn in Programs 3 or 4! If you turn in a working Project 2, this will count as your Programs 3 and 4 since it is a superset of their functionality.

Over the course of the semester there will be 3 or 4 programming assignments, in addition to the projects. The purpose of these assignments is to give you some practice with the tools that you need to use to make your projects, not really to teach you about graphics. Also, we want to make sure you get used to the mechanisms for turning in projects.

The programs count for a minuscule part of your grade. Such a small amount, that we may not look at them too closely in grading, nor will will accept late assignments. If you don't hand something in, you get no credit.

The assignments are open ended. You might choose to do something very minimal, or you might try to show off how clever and creative you are. We will try to notice things that are cool, although we will not reward them with better grades. For some programs, we will reward particularly amazing programs with a small prize.

Because you must explain to us what your program does, we should be able to know if its particularly noteworthy.

For each assignment, you must turn in:

  1. A file named "readme.txt" that explains what your program does, and how it does it. Be clear about what code you have used: remember, using someone else's code (including the instructor's sample code) without proper attribution is plagiarism.
  2. A Visual Studio workspace (.dsw) and project (.dsp) file required to build your project. Your project should build on standard CS NT machines. There should be exactly 1 workspace file.
  3. All source code required to build your project. Generally, this will be C++ source and header files. But if you do something like fluid or resources, be sure to include that as well. Please do not use any absolute paths to things in either your project directory or home directory.
  4. To build your assignment, we will copy your handin directory to c:/temp on a CSL Win2K machine, double click the .dsw file (to run visual studio on your workspace), and press F7 (compile). Your program must build with no errors (and preferably, with no warning). Pressing CTRL-F5 (run) should cause your program to run. You might want to check to make sure this works (that there are no dependencies, ...)

You must NOT include any binary files (executables, object files, debugger information, ...). We have limited disk space, so please follow this rule.

You will turn in your files by copying them to a handin directory that we will specify.

The assignments themselves are very minimal. In fact, for most cases, you could just take the sample programs we give you, change some of the comments, add a readme, and turn that in. However, doing this misses the point: in order to complete the projects, you will need the skills checked by these assignments.

Handin Directories

Your handin directory will be in
for example, my assignment one would be:

Because of space issues, it is important that you do not put any binary executable files into this directory (sometimes, we might ask you to put in a picture or two).

Do not use this directory as your "working" directory. You should only place files into this directory when your program is complete.

Programming Assisngment 1: Programming Warmup

Due September 13th, 5:00 pm.

The goal of this assignment is to make sure you can write interactive C++ programs under windows.

Your task is to write a program that shows that you know how to write programs in C++ under windows using the fltk (or some other) library. (note: if you want to use another programming language and/or windowing library, read this page first).

Your program should (at least) put up a window, respond to some user input, and do something in response to the mouse. We really don't care what your program does, as long as in the process of writing it you figure enough about the programming tools so that next week when we ask you to write a program to do something real, you've already figured out the basics (like how to run the compiler, how to configure the compiler to use fltk, how to put up a window, how to respond to the mouse, ...)

We will even post some sample programs (coming real soon - check back here) so you can see how we do it.

We will generate the directories based on the account info given to us by the registrar and CS lab staff. We will not make the accounts until Monday 9/11. If you look in the p:/course/cs559-gleicher/handin/Assignment1 directory and don't see a directory for yourself, send email to the TA. Note: there will may be a delay between your request and when he can make the directory for you, so please ask before Tuesday.

Do not work in the handin directory. Copy your files there once the program is working. (there won't be enough disk space for everyone to put all of their working files in the handin directory). You should only copy the following files into the directory:

  • the C++ source and header files
  • the fluid source files (.fl) if you use fluid (if you don't know what fluid is, don't worry)
  • your Visual Studio workspace file (.dsw)
  • your Visual Studio project file (.dsp)
  • any other source files (for example, if you use MFC you would have resource files)
  • a readme.txt file that explains what your program is, what it does, how to build it, what pieces you "borrowed," what each of the files is, ...

In short, we need all the files necesary to build your program (and a readme file). We do not want the executable, the debugging information, the .obj files, ...

Also, you need to configure things so they will compile in the CS environment. If you build your programs at home or somewhere besides a CS machine, you will probably need to change your project settings. How this assignment will be graded:

This assignment is different from most others since what we care about is that you figure enough out about how to program with C++, NT and fltk that you'll be ready to do a real programming assignment when we give it to you next week. Therefore, we will look at your program, make sure its correctly documented (so make sure the readme file explain what the program does), and probably look at your code to give you an idea if your coding meets our level of expectation. We probably won't check to see if your program actually works. We will care if you follow directions. So I highly recommend you turn in the right files before the due date.

The idea is that if you blow off this assignment now, you'll have problems later (like next week) when we ask you to actually write real programs. So, if you were lazy, you could copy one of the example programs, add comments giving proper attribution (remember the academic conduct rules!), add a readme file, and get full credit for the assignment. However, you may regret it (as soon as next week) when you're trying to figure out the basics of writing a program in C++ on NT with fltk, AND the graphics stuff you need to do.

On the other hand, if you're inspired and right some really cool program (be sure to describe it in your readme file), we may try it out to see how great it is.

Programming Assignment 2: Reading and Writing Images

Due September 20, 5:00 pm.

The goal of this assignment is to make sure that everyone can write a program under Windows NT that can read and write TGA images.

For projects in this class, you will be required to read and write images in the Targa (TGA) format. While Targa is a relatively easy image format, it is still a hassle to write a good reader, so most programs use a library written by someone else. If you want to write your own Targa reader, you are welcome to. However, you must make sure it works with our test images (which we will provide). To be honest, there are much more fun programming projects.

We will provide you with a very easy to use library called libtarga. You are free to use some other library, but we strongly encourage you to use this one since its easy, and we can help you with it.

Your program for this assignment needs to:

  1. Take a command line argument with a TGA file name.
  2. If no command line argument is given, prompt the user for a TGA file to read. If you are using FlTk, we recommend using the fl_file_chooser.
  3. Display the image in a window.
  4. Wait for user input, and upon recieving that input change the image in response to it.
  5. If the user gave 2 file names on the command line, write the changed image to that second file. Otherwise, prompt the user for a file name, and write the image to that file.

One trick here: your program must take 0, 1 or 2 command line arguments. We will provide you with an example program that does this. In fact, we will provide you with a complete solution for this assignment.

We don't care what your program does to the image. You can just change the value of 1 pixel. Or you can do something cool to the image. Be sure to describe what you do to the image in your readme file.

The handin instructions are identical to those for Assignment 1. (except the directory will be assignment 2, and we will make the directories on 9/19).

Programming Assignment 3: OpenGL

Due October 18, 2001, 5pm

The purpose of this assignment is to give you practice with the basics of working with the OpenGL graphics library. You will need to use OpenGL for the next programming projects.

In this assignment, we are asking you to use OpenGL to do 2D drawing. So, if you're ambitious and do 3D drawing, that's OK, but we suggest you start with the easier 2D . Also, don't use fltk or other 2D drawing things. We really want you to use the 2D stuff in GL. (which is actually the same as the 3D stuff, but that's another story).

You must write a program that:

  • Opens a window.
  • Allows the user to draw shapes (rectangles or lines are fine) using the mouse. It is important that the shapes are drawn where the user clicks/drags the mouse.
  • Allows the user to pick from the previously drawn shapes by pointing at them with the mouse. You must do something to show what shape has been selected (for example, highlight its color, or have it move to follow the mouse).
  • You must use OpenGL for the drawing.

Note: unlike previous practice assignments, we are not giving you an example solution beforehand. However, the sample code and the GL Survival Kit should get you most of the way there. Figuring out how to convert from mouse coordinates to positions in your window will force you to think about the transformations that GL is performing.

As in the previous assignments, you are welcome to do more interesting programs. Make sure that you explain what your program does in the README file.

Programming Assignment 4: 3D and OpenGL

Due October 25, 2001, 5pm

The purpose of this assignment is to give you the opportunity to get familiar with OpenGL. Everything that you do will be directly relevant to the next project.

As with the other programming assignments, the requirements are minimal. Your program must:

  1. Open a GL window
  2. Provide a prospective view of some objects that uses z-buffering to provide occlusions
  3. Allow the user to interactively manipulate the view (e.g. viewpoint, view direction, field of view)
  4. Allow the user to move the objects around.
  5. Use double-buffering.
Again, the requirements are pretty minimal. You can draw simple things (a box or two), and provide a very simply interface (say, use sliders to control x,y,z for lookat and lookfrom).

To encourage you to experiment with better interfaces, we will provide you with some example code that implements a basic 3D user interface using a "virtual trackball."

To be honest, the simple one I give you has some problems. You might want to look around on the web for better ones. (I suggest looking for something called an "arcball" for example). Or you can wait for Mark to give you his. (which he will).

Mark will provide a complete solution to this assignment. Be warned: project 2 is coming up, and this assignment is a good running head-start for it. Be sure to understand this assignment! We will explain most of the graphics technology (e.g. what double-buffering and z-buffering are) in class.


UW Graphics Group

CS559 Web

Home Resources Assignments Tools  
Calendar Policies Projects 1 2 3   Examples
Copyright (C) 2001 by Michael Gleicher
Last modified: 19:10 Nov 15, 2001