Programming Computer Graphics

For your first programming assignment, you will be working with an existing OpenGL program. The purpose of this exercise is to ensure that you can compile and run a graphic program. You may do your assignments on the Sun computers in the Atrium, or on your own PC using Visual C++. If you would like to use a different development platform, please see me.

Assignment #1: Smiley

  1. You will need to activate your ITS unix account whether or not you will be doing your programming on that platform. Take note of your username on this system; you will need it later. Create a subdirectory named pickup.d with the following command:
    mkdir pickup.d
  2. Create a subdirectory (folder) where you will do all of your programming work (on either the Sun or your PC). Copy the following files into this folder:
  3. Compile and run the smiley program. Follow directions for either the Sun computers in the Atrium, or on your own PC using Visual C++.
  4. Edit the smiley program, making the following changes:
    • Change the 4th argument to gluDisk to make the circle smoother.
    • Change the square eyes to tall rectangles.
    • Change the straight mouth to a smile.
    • Change the color of the background, face, eyes, and mouth (hint: look at tkmap.c to see what colors are available).
  5. Compile and execute your modified file to check your results. When you are finished,
    • copy both the source file and the executable file to the pickup.d subdirectory on your unix system (use FTP if you are working on a PC)
    • create a PICKUP file in that subdirectory with the following command:
      touch pickup.d/PICKUP

Sun Computers

The Sun computers use the OpenGL and GLUT libraries on /sw8. To access these, you will need both Makefile and Make-config in your working directory. To compile and run your smiley program, simply type:

make smiley
smiley

Visual C++

Before anything else, you will need to install the GLUT libraries on your system. Go to http://www.opengl.org/developers/documentation/glut/index.html?GLUT#windows?GLUT to get the zip file. Unzip the file, and then move the following files:

After compiling your program, you will need to change the project settings to link with the OpenGL libraries. Click on the link tab, and add the following to the list of libraries:

opengl32.lib, glu32.lib, glut32.lib