This document
explains how to set up GLUT to work with your development environment. There
are 3 sections, one for each of the major platforms. Each set of instructions
is split into two sections. The first section need only be performed once to
setup GLUT on your computer. The other needs to be performed each time you set
up a new OpenGL project.
Here we assume you
are using Visual C++.
One Time
Setup
Download the windows GLUT distribution from http://www.xmission.com/~nate/glut.html
. Make sure you download the bin zip
file.
Unzip glut.h and glut.lib somewhere to
keep them permanently (i.e. not in your project directory). Unzip glut32.dll
somewhere in your path so it will be accessible by all GLUT programs
(C:\Windows\system32 will work, or put it someplace and add that directory to
your path by right clicking My Computer, clicking Properties, click the
Advanced tab, click the Environment Variables, and either edit or add the PATH
variable under the User Variables section to contain the location of the file).
1.
In Visual Studio, go to Tools -> Options...
2.
In the Options window on the left select "Projects and Solutions"
-> "VC++ Directories".
Now glut.h and glut32.lib will always be accessible for your
projects.
Per Project
Setup
To add the library to the list of libraries to link
to, go to Project -> Properties...
1.
Select Linker -> Input in the tree on the left.
You should now be
able to compile a GLUT program. The GLUT header will just be glut.h (i.e. #include <glut.h>). The GL headers will be GL/gl.h and GL/glu.h.