Fall 2005


Sample Code

Project 1
Project 2
Project 3

Basic Info

C++ hints

Note: all assignments and projects are due at the begining of class (9:30 am) on a Tuesday.

Note: programming warmups and written assignments are graded "check/nocheck." However, it is in your best interest to do the work since the material will appear again in projects or on exams.

Written Assignment 1

Written assignment 1 - Mathematics Warmup - due 9/13/2005

The questions are here. Please hand in a page (or however many you need) with your answers in class.

The purpose of this assignment is to give you an idea of the kinds of mathematical reasoning you will be doing this semester. If you're completely stuck on some of the concepts, you might want to refresh your memory from your linear algebra course (or re-learn it).

Programming Assignment 1

Programming Assignment 1 - C++ Warmup - due 9/20/2005

The purpose of this assignment is to make sure that you can use the tools that you need to do future assignments and to follow class rules. Basically, we want to make sure you can figure out how to compile a program and hand it in now - rather having you realize right before a project that you can't get these basic things done.

You must hand in a program that does the following:

  1. Put up a window (probably with FlTk)
  2. Have a button in that window that causes something to happen (e.g. use a callback)
  3. Have some kind of widget that has state (e.g. a slider or a toggle button) that the user can change, and to have the program respond to this.
  4. Have some kind of widget (of your own creation) that does something in response to mouse input.

It doesn't matter so much what your program does - we are more interested in making sure you can write and hand in some program. Of course, if you make a program that does something interesting, that will be more fun for us.

We will provide you with an example solution to look at. In fact, it is totally acceptable to simply copy this program (providing you follow the rules and give proper attribution.

Handing the assignment in:

The procedure for handing in this assignment will be the same for all programming assignments and projects, so its best to figure them out now.

We will create directories on Tuesday, September 13th (probably in the afternoon) based on the course registration list provided to us by the CSL (who gets the information from the registrar). 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 Friday 9/16.

The rules for turning in programs are on the policies page. Some things to keep in mind for this assignment:

  • Remember to give proper attribution for code that you borrow.
  • Remember to turn in all files required to build your program. Even if we don't actually build your program, we will check to see if its there.
  • Remember to turn in a README file explaining your program. For this assignment, it is important to explain what your program does (and why it meets the requirements).
  • Remember that you DO NOT TURN IN BINARY FILES. Don't copy the "DEBUG" directory (with the intermediate files) or the resulting executable. We do not have sufficient disk space for every one to turn in binary files.

How your program will be evaluated:

This assignment is different from most others since what we care about is that you figure enough out about how to program with C++, Windows 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 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.

Programming Assignment 2

Programming Assignment 2: Imaging Warmup - Due 9/27/2005 9:30am

In later programs and projects you will be processing images. For this programming practice assignment, we want to make sure that you can read an write image files.

For this class, we will use the Targa or TGA file format. We have a special library, call LibTarga that was written specially for CS599. It is designed to be simple to use, but it does not handle all features of the Targa file format. For the purposes of this class, we will only use the things that LibTarga can do - our definition of the Targa format is the set of files that LibTarga can read and write.

The LibTarga web page is here. However, the documentation of how to build LibTarga on CSL computers has changed. You should look at the tutorial for this class.

For this assignment, your program can be very simple. It must:

  1. Be a command line program that takes 2 arguments. If it takes more than 2 arguments, those extra arguments must be optional (the program should still work if you only give it 2 arguments)
  2. The first argument is the name of a Targa file to read.
  3. The second argument is the name of a Targa file to write.
  4. Your program should read in the first file, change the image some way, and write it out to the second file.

This is a good time to practice making your programs robust. For example, make sure that your program gives an error message if there's a problem like a bad input file. It should not crash - even with bad inputs.

It doesn't matter what your program does to the images. At this point, we just want to make sure that you can read and write images. You'll get to write lots of code to actually do things to the images later.

At least one of the tutorials is a solution to this assignment. Its OK to simply turn one of those in (provided that you follow the rules). Grading is similar to the first programming assignment. If you can't read and write images, or you can't turn in an assignment correctly, you will have trouble later.

Of course, you are welcome to have your program do something cool to the image. If so, be sure to tell us so we can check it out.


Programming Assignment 3

Programming Assignment 3 - Interacting with Images - Due October 11th.

Note: This assignment is due as part of Project 1. We will grade is along with Project 1. A good solution for Project 1 will also satisfy the requirements for this assignment.

You must write a program that:

  1. Read in a TGA image using LibTarga
  2. Displays it in a window
  3. Allows the user to click and drag over the image and have the image change in response. For example, you can paint the pixels underneath the mouse.
  4. Write out these changes.

Your program should ask the user for targa file (for example, try using the FlTk file dialog box).

How the image changes is up to you - changing the color of the pixel under the cursor is one simple thing. Don't worry if the program "feels" slow - chances are, you'll be redrawing the whole image after each pixel change. Writing your program so it allows for fast painting is trickier - and is not something that you need to learn for class.

How this will be graded: As part of your project 1 grading you will give a demonstration of your project. During this time, we will check to make sure that you've written a program that fullfills the requirements for this project. You will build and run your program for us. Your "answer" for assignment 3 might actually be a demonstration of your project 1 program, or you can compile and build something different.

Written Assignment 2:

Is available here.

Written Assignment 3:

Is available here.

Programming Assignment 4:

The purpose of this assignment is to make sure that you can write an OpenGL program - just to check the mechanics (can you get it to compile, link, ...)

Your task is to write a program that uses OpenGL. We recommend that you use FlTk (see the OpenGL survival guide for an explanation), but you can use any windowing tools you see fit.

Your program must draw something in the window (using OpenGL) and be able to have it move. You should have a button or a key that starts/stops the motion. You can use the RunButton example code to make this easier.

As with the other programming assignments, it is OK if you simply turn in one of the tutorials that meets the needs (providing that you give proper attribution, follow the handing procedures, ...).

Your program should use double buffering.

In the coming weeks, you'll be doing a lot of OpenGL programming, so now might be a good time to start learning about it.

Programming Assignment 5:
3D User Interface

The main purpose of this assignment is to give you some experience with writing 3D graphics programs. Specifically, we want you to be able to do the things you will need for the first project. Effectively, this program is the warmup for the first project.

Your program must:

  1. Open a GL Window
  2. Have a "World" with a groundplane
  3. Allow the user to manipulate the viewpoint
  4. Have a number of simple, small objects in the world (little cubes are fine).
  5. Have a way for the user to add more objects.
  6. Allow the user to select an object (the selected object should be indicated somehow) and move it around.
  7. Use double buffering

For the user interface, you don't have to do anything fancy. For example, you could give the user a bunch of sliders to control the camera, use a slider to select an object, and have sliders for its position. You could even have the user type in the coordinates of points.

Or, you could have a "direct" interface where the user selects objects by clicking on them, and drag the objects around using the mouse (which is a tricky thing since the mouse is 2D and your world is 3D).

While this might seem like a lot of work for a programming assignment, all of this will be used as part of Project 2. Taking the time to do this assignment well will mean that you are very close to having what you need for Project 2.

Example solutions are given here. You'll probably want to borrow some code.

Programming Assignment 6: 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.

Written Assignment 4:
Lighting and Surfaces

Is available here