UW Graphics Group

CS 559: Computer Graphics
Fall 2001

CS 559 Home
Calendar Resources Assignments Projects 1 2 3  

Example Code


The following is an example program that allows you to read/write targa images. It also allows you to paint green lines over the image. It may be used as a satisfactory completion for assignment 2. LibTarga information is available here.


Look for Richard's tutorial on how to build FlTk programs in the CS environment. (Richard was the TA for 559/638 in the Fall of 1999)

He provided a sample program (with all files) as well as a project that compiles on of the standard FlTk demos.

I wrote a very small program that aims to demonstrate how to do an FlTk callback. It is here. It is one cpp file, and a dsw and a dsp file.


My Tutorial on OpenGL basics for this class has a few examples. I have also added an example of how to do animation with GL and FlTk that provides some support code that might be useful in your projects. I have made a simple demonstration of drawing stuff in 3D with GL. Right now, the demo shows hack shadows (as we will discuss in class) and provides a basic interface for moving the camera around. It does not do lighting. Be warned: while it gives basic methods for doing things, it doesn't necessarily do them well. For example, the camera interface uses fixed axes and therefore suffers from severe gimbal lock. Also, it doesn't do any fancy GL tricks to make things look nice. If some GL wizard were to send me a nicer set of hacks to make things look better, I would encorporate them (especially for nicer looking shadows)
  • 3d.cpp - the basic driver
  • 3DUtils.H - some utility routines you may use too
  • 3DUtils.cpp - the code for those routines
  • Gl3D.dsp, Gl3D.dsw - a project file to build the program
  • MyArcBall.H, MyArcBall.cpp - a very simple implementation of an ArcBall, which is a much nicer way to control the view than the "orbit" routine I had in 3DUtils.

A brief explanation of the arcball is provided from Graphics Gems IV. Be warned: arcballs use Quaternions (a representation for rotations) that we haven't discussed in class. Also my implementation strips away all of the fancy arcball features.

Mark (the 559 TA from fall 2000) has also provided a sample solution to Program 4. It provides a similar, but different interface than mine:
  • Mark Pingel's demo 3DGL (Mark was the 559 TA for Fall 2000)


This is a sample skeleton Driver for Project 1 of 2000. It should give you some ideas as to how to build your main loop. Warning: this is for the year 2000 version of the project. 

Texture Manager

This is a tool designed to make things a little easier to use textures in opengl. You can use it in place of glBindTexture. Instead of taking a number that is a "texture name," you pass it a string that is the name of a TGA file (without the .tga extension). If the image hasn't been loaded for you, it will get loaded in.  Note: this uses libtarga.

Project 3

Example code for project 3 from the Fall of 2000. 

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