# CSC 222 Computer Graphics

## Fall, 1995

This course meets from 9:25-10:40 AM TTh in Business 15. The syllabus is available in LaTeX, DVI, and Postscript.

A schedule of lectures tells what I plan to talk about, and what I expect you to have read, by each class meeting.

I also taught this class in Fall 1995.

The textbook will be Interactive Computer Graphics, by Edward Angel, who has also provided a variety of supplements and resources, including on-line programming examples. Many of these examples have been downloaded and are available locally.

This semester, we'll use the graphics package OpenGL (see online documentation), together with the Graphics Library Utilities Toolkit (GLUT). As of September 15, both of these are installed and working on panther; we don't have them working on the Windows NT machines yet. (If you have a Windows NT machine yourself, with an up-to-date C/C++ compiler, you can install it yourself; see these instructions, thoughtfully provided by Uri Avalos.) But until we do, we can write graphics programs and run them on any X workstation, including whichever of the Windows machines have X servers installed.

## Homework Assignments

Homework 1, assigned 18 Sept, due 25 Sept, extended to 30 Sept.
any one of the problems 2.1, 2.2, 2.7, 2.8 in the textbook. These are all programming problems, to be turned in by email or (if we have OpenGL working on Windows by then) on floppy.
Homework 2, assigned 21 Oct, due 6 Nov
Write a program to draw some interesting three-dimensional object (e.g. a cube, a polygonal prism, etc.) on the screen, and allow the user to translate it along any of the three axes, and rotate it around any of the three axes. This means twelve possible motions: plus or minus x translation, plus or minus y, plus or minus z, clockwise or counterclockwise rotation around x, around y, around z. If you have time, implement a toggle that switches between parallel projection and perspective projection. Choose and implement an appropriate and friendly user interface.
Homework 3, assigned 4 Nov, due around the end of the semester
Individual projects. Due 20 Nov: give me a detailed written description (on paper or by email) of your proposed project, including the sequence of steps you plan to go through, and what capabilities your program will have at each stage.

By Thursday, 4 December, you should have read Chapters 1--8 and Appendices B and C of the textbook.

Several example programs are in Appendix A of the textbook. For each of the following programs, I recommend that you copy it to your own directory, compile it, run it, modify it, run it again, \emph{etc.} until you thoroughly understand how it works. This is not to be turned in; it's just an exercise to get comfortable with programming in our environment.

Please read the online documentation for GLUT, particularly sections 1, 2, 3, 4, and 7.

## Using OpenGL

I've installed the OpenGL include files in /usr/local/include/GL, and the OpenGL link libraries in /usr/local/lib. So you should be able to write
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
...

in your C or C++ program and get it to compile. (If this doesn't work, try
#include "/usr/local/include/GL/gl.h"

and so on instead.) You'll need to tell the C/C++ compiler what libraries to use. "-lglut -lGL -lGLU -lXmu -lXi -lXext -lX11 -lm" at the end of the command line should do the trick. Probably the easiest way to do all this is using the Makefile provided with the textbook examples: copy this to your own directory, and if you have a program whose source code is foobar.c, just type make PROG=foobar. You can then run the program by typing foobar.

Probably the easiest way to run these programs and look at the results is to log onto one of the DEC Alpha workstations around campus (e.g. wolf, adl11, adl12, adl13, adl14, etc.), open a dxterm or xterm window, type
or the equivalent for whichever workstation you're on, and run the programs from the Unix command line in that xterm window.

Kris and Uri have also been installing X servers on some of the Windows machines, so we can run programs on one of the Alphas and see the results on the screen in our classroom. To do this, first find a computer with an X server installed and double-click the "X Server" icon. You'll be asked for an ID and password, which I gave out in class (ask me if you didn't write them down). This will log you into the csc222 account on a computer named "darksun", from which you can run programs pretty much as above: open a dtterm or xterm window, type
setenv DISPLAY b33_006:0.0
or the equivalent for whichever computer you're on, and run the programs from the Unix command line. However, since you're not logged in as yourself, you don't have access to your own files. Note which display you're on, type
(using your own userid in place of "myuserid"), then
setenv DISPLAY b33_006:0.0
or the equivalent for your computer, and go to town.

## Other Neat Stuff

For examples of some of the neat stuff people do with computer graphics in the context of geometry, take a look at
the University of Minnesota Geometry Center.
Lightscape Technologies, Inc, a computer-graphics software company.
the Computer Graphics Virtual Library.