CS559
Fall 2003
 

CS559 Programming Assignments

The purpose of the programming assignments is to make sure that you can use the tools needed for the programming projects.

Note: In all cases, we will provide you with a sample solution. It is actually acceptable to simply turn these in (providing you follow the rules, especially involving documentation and attribution).

What we care about is that you work out the mechanics required to do the upcoming projects.

Assignment 1: Write a Program!
Assignment 2: Read, Display, Change, and Write and Image!

Assignment 1: Write a Program!

The goal of this assignment is to make sure you can write interactive C++ programs under windows, and that you can follow the class rules.

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, talk to us 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 learn enough about the programming tools that next week when we ask you to write a program to do something real, you already know 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 soon - check back here) so you can see how we do it.

Handing homework in:

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

Please check the rules - DO NOT TURN IN BINARY FILES! (if you do, we'll run out of disk space).

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 Windows 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.

To encourage you, we will have a little contest for the coolest program. This will be selected by the instructor and TA. In addition to the satisfaction of knowing you wrote the coolest 559 homework assignment, we will also give out a small prize (probably a stylish graphics group T-Shirt).

The purpose of the programming assignments is to make sure that you can use the tools that you need to do the programming projects.

Note: in all cases, we will provide you with a sample solution. It is actually acceptable to simply turn these in (providing you follow the rules, especially involving documentation and attribution).

What we care about is that you've worked out the mechanics required to do the upcoming projects.

Assignment 2: Read, Display, Change, and Write an Image!

For this assignment, we want to make sure that you can work with images since you will very soon be given your first project that will involve them.

You must submit a program that:

Prompts the user for a file name (doing this in the console window is fine, or use an FlTk file dialog) for a TARGA image file (.tga)

  1. Loads in the targa image (you will probably want to use libtarga)
  2. Displays the image in a window
  3. Changes the image in some way
  4. Writes the image back out to another targa image.

Like Assignment 1, we don't care much what your program does. We just want to make sure you are able to work with images. You don't have to do anything interesting with the image, just change it somehow. Of course, if you do something cool, that's more fun. Be sure to tell us in your documentation what your program does.

We may reward the coolest program with a graphics group T-Shirt.

Again, please follow the rules and turn in only the correct files. The handin directory is a2.

Assignment 3: Write an OpenGL Program!

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. 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.

Assignment 4: Write a 3D program!

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" or "arc ball". The arcball was implemented in a way that should make it easy for you to add it to your own program. The code is here.

We also provide a different solution provided by Mark Pingel, the TA from 559 in 2000. His is 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.

Programming Assignment 5: Texture Mapping

For this assignment, all you have to do is write a program that displays an object with a texture map (using OpenGL).

You will need to use texture maps in the upcoming project 3, so you should get used to them now.

To help you work with texture maps, i have given a page of hints. This page of hints include a Texture Managaer that can make things a lot easier for you. I recommend you at least look at it.