To Get Your "Hello World!" OpenGL Program Running


About OpenGL and GLUT

OpenGL is a low-level graphics library specification, and itself only provides programmers a small set of simple geometric primitives (points, lines, polygons) to work on. OpenGL provides a primitive set of commands for rendering, and higher-level rendering is composed by these commands.
We use the GLUT (OpenGL Utility Toolkit) to aid in the easy development of rendering complicated 3d shapes and scenes.
GLUT simplifies the implementation of programs using OpenGL rendering. The GLUT application programming interface requires very few routines to display a graphics scene rendered using OpenGL. The GLUT routines also take relatively few parameters. Therefore, it is an easy starting point to learn OpenGL.

Libraries Installation

You can simply start OpenGL programming once you have the following set up:

1. Download

Download either the precompiled GLUT bin libs, or (if these bin libs are not compatible) GLUT source codes and re-compile them in your system to get these libs
(1) If you are installing GLUT to a 32bit computer, please either

check Nate Robins' webpage: http://www.xmission.com/~nate/glut.html

or download them here

GLUT 3.7.6 pre-compiled libs: http://www.ece.lsu.edu/xinli/OpenGL/glut-3.7.6-bin.zip

GLUT 3.7.6 source codes: http://www.ece.lsu.edu/xinli/OpenGL/glut-3.7.6-src.zip

(2) If you are installing GLUT to a 64bit computer, and the above (1) doesn't work, you may check GLUT's 64bit mode at:

the GLUT64 webpage: http://www.idfun.de/glut64/

or download them here

GLUT 3.7.6 pre-compiled libs: http://www.ece.lsu.edu/xinli/OpenGL/glut-3.7.6-bin-32and64.zip

GLUT 3.7.6 source codes: http://www.ece.lsu.edu/xinli/OpenGL/glut-3.7.6-src-32and64.zip

2. Compile

Compile the source codes in your system environment (especially if the pre-compiled libs do not work properly)

Finally, get the following three necessary files:

(1) glut.h -- place it in the "include\GL\" subdirectory of your Visual C++, and include it in your source codes

(2) glut32.lib -- place it in the "lib\" subdirectory of your Visual C++

(3) glut32.dll -- place it in the "\Windows\System32\" subdirectory of your system disk. (* Note, if you are using Windows Vista, and your VC still can't find this dll, then you can put it in your project run directory


Writing OpenGL/GLUT Programs

1. Create an empty new project with the type of Win32 Console Application.

2. Designate these library files "opengl32.lib glu32.lib glut32.lib" in the project setting for the linker to use

3. Write your OpenGL codes, remember to include the GLUT header file:

#include < GL/glut.h >

and you don't need to include gl.h, and glu.h anymore since they are already included in glut

4. Compile, Build, and Execute.


Some Useful Links:

Official OpenGL Site GLUI User Interface Library
OpenGL Utility Toolkit (GLUT) FLTK User Interface Library
OpenGL Programmng Guid (The Red Book) OpenGL Reference Manual (The Blue Book)
Nate Robins OpenGL Tutorial NeHe Productions
SGI OpenGL Samples Back to my homepage...