Introduction to Computer Graphics
CSE 470
Arizona State University

Instructor: Dianne Hansford
Teaching Assistant: Robby Walker

Spring Semester 2005
Monday & Wednesday, 3:15 -- 4:30pm, BYAC 210

reference material

Getting Started

Get VC++ 6.0

For your home computer, you can download VC++ 6.0 for free.

OpenGL, GLUT, Windows, and VC++

OpenGL comes with all Windows machines. GLUT does not, so you will need to follow steps outlined below. The steps for setting up GLUT and starting a new program are simpler for VC++ 6.0 than for .NET, but both are outlined below.

Help with VC++ .NET and OpenGL in the CSE (Brickyard) Lab

First: you should use the black machines in the CSE lab. Debugging is only available on these machines. Robby has outlined the steps to follow for creating a new application.

  • Start Visual Studio .NET * File -> New -> Project * Select Visual C++ Projects -> Win32 -> Win32 Console Project
  • Give your project a name and choose where to store it
  • Click Finish
  • Disable support for precompiled headers (you need to do this to run the example code)
  • Remove the '#include "stdafx.h"' line from your project1.cpp
  • Open Project -> projectname Properties (last option)
  • Go to C++ -> Precompiled Headers
  • Change "Create/Use Precompiled Header" field to "Not using precompiled headers"
  • Add glut32.lib to your linking settings
  • You should still be in the project settings window
  • Choose Linker -> Input
  • Add 'glut32.lib' to your Additional Dependencies
  • Click OK to return to your main project window
  • Now we need to load the glut files
  • Put the glut32.dll in the same directory as your executable
  • Download glut-3.7.6-bin.zip (117 KB)
  • When the zip folder opens, copy glut32.lib glut32.dll, and glut.h to the directory you stored your project in
  • Now, any time you see '#include <gl/glut.h>' replace it with '#include "glut.h"'
  • You should now be able to build your project
  • Also, if you paste in code from any of the examples it should work

VC++ and GLUT on VC++ 6.0

The GLUT files go into folders that are mirrored by their OpenGL entries. I would recommend searching for the opengl files mentioned below to find the folders specific to your machine.

  1. Your "WINDOWS/system32" folder should already contain openGL32.dll and glu32.dll. Copy the glut32.dll here.
  2. The opengl32.lib will live in a folder named something like "..\VC98\lib". Copy the glut32.lib file here.
  3. Similarly, the gl.h file will live in a folder like "..\VC98\include\GL". Copy glut.h here. (Note that glut.h defines all the necessary opengl include files, so you only need to include it in your program.)

To start your own program in VC++ do the following.

  1. Start VC++
  2. File->New->Open a console application
  3. Select an "empty project" and pick a name and directory
  4. File->New->C++ source (pick a name and directory)
  5. You are ready to go! (See a sample program for the basic includes and program structure.)

If you are not allowed to put files in the system and VC folders, then do the following.

  1. Put the GLUT files in a folder of your choosing.
  2. Open VC++
  3. Choose Tools->Options
  4. Choose the "Directories" tab.
  5. In the lib, include, and executable sections, add the folder in which the GLUT files live.
  6. With this set-up, the <GL/glut.h> in your program needs to be changed <glut.h>

top

Sample Programs

Date Program Demonstrates
24 January basics.zip Basics of OpenGL and GLUT.
How to open a graphics window. Basic flow of a graphics program. Event loop and callback routines. OGL as a state machine. Effects of window resizing by the user.
26 January interaction.zip Animation via the IdleDisplay callback
Single- versus doublebuffer modes
Push and Pop of the ModelView matrix
Reshape display and maintain the aspect ratio
Viewports
31 January more_interaction.zip Mouse motion to rotate a box
Mouse click to place an object (window to world transformation)
Special key input (arrows for zoom in and out)
Key input (Q key to quit)
2 February menus.zip Pop-up menus and submenus
21 February wireframe.zip Z-buffer hidden surface removal
Wireframe display modes -- wireframe with hidden surface
gluLookAt use, glOrtho use

 

OpenGL Resouces

An online version of The Red Book
The OpenGL Bible -- a book liked by many, including Robby
"Man pages" of The Red Book
OpenGL.org -- more than you need to know
Nate Robbins' Tutorials -- example code
Lighthouse 3D
NeHe Game Productions -- tutorials and downloads; direct windowing system interface

 

GLUT Resources

API Documentation Nate Robbin's GLUT page

GLUT Files

See the Lighthouse3D link below for a nice tutorial on set-up.
Lighthouse 3D Plenty of good examples on using GLUT. This tutorial also discusses VC++ and GLUT.
GLUI This is a GLUT based user interface library with radio buttons, check boxes, spinners, etc.
Please see me before you use this.
   
   

 

Computer Graphics Resources

CG Texts

Interactive Computer Graphics with OpenGL by Edward Angel

Computer Graphics by Hearn & Baker

Computer Graphics with OpenGL by F. Hill

Fundamentals of Computer Graphics by Peter Shirley