- What is GLUT?
GLUT stands for OpenGL utility toolkit. Using GLUT eliminates the need to
and understand basic GUI programming on any specific platform. Even though you
can't rely entirely on the GLUT library for everything, it excels in its role
for learning and demontration exercies since it hide all the platform specific
details of window creation and OpenGL context initialization.
Online
GLUT Manual.
- Installation
If you are running a 32-bit operating system, do the following:
- The file opengl.dll are already installed in the directory
C:/WINDOWS/system32/, while gl.h and glu.h are
already included with
Visual Studio.
- Download GLUT for Win32
- Unzip the file
- Copy glut32.dll into C:/WINDOWS/system32
You will need administrator access to do this.
- Setup build environment
Your build environment will need to know where the header file and static
library for GLUT are located.
- Visual Studio
- Copy glut32.lib into C:\Program Files\%YOU VISUAL STUDIO DIRECTORY%\VC\Lib
Change %YOU VISUAL STUDIO DIRECTORY% to the directory of the Visual Studio that you have installed. e.g. for Visual Studio 8: %YOU VISUAL STUDIO DIRECTORY% = "Microsoft Visual Studio 8"
You will need administrator access to do this.
- Copy glut.h into C:\Program Files\%YOU VISUAL STUDIO DIRECTORY%\VC\Include\gl
If the gl directory is not there, then you can simply create it.
You will need administrator access to do this.
- Build Sample application
Now we should test that this installation and build environment are correct by building a sample application.
Premade
- Download a premade Visual Studio Solution.
- Unzip the sample App.
- Build and run the sample App.
From Scratch
- Create a new project in the IDE you are using.
- Use SampleGlut.cpp for your code.
- Link to glut.lib
- Visual Studio
Right click on your project in the Solution Explorer ->
Select the Properties Menu.
Select the "Configuration Properties"->Linker->Input item.
Add glut32.lib in the text box next to the Additional
Dependencies label.
- Linux
Compile using "cc -o simple simple.c -lglut -lGLU -lGL -lXmu -lXext -lX11 -lm".
- Build and run the sample App.