OpenGL and GLUT HOWTO
OpenGL Online References
Windows Visual C++ Express
-
Windows has OpenGL libraries included, and Visual C++ has the necessary
OpenGL and GLU header files.
GLUT libraries and headers are NOT included. You need to download the
GLUT distribution from
http://www.xmission.com/~nate/glut.html.
Download the zip archive
glut-3.7.6-bin.zip (117 KB).
-
The zip archive contains 3 critical files (glut.h, glut.lib, and glut32.dll)
in addition to some others which are not needed.
These 3 files must be installed in 3 different locations for GLUT programs
to compile and run. An easy way to perform this installation is to use
Windows Explorer (the file manager). Open Windows Explorer, navigate to
the zip archive you downloaded, right-click on it, and then click Extract All.
-
Install glut.h into the Visual C++ Include directory. Right click on
glut.h in the archive you downloaded and select Copy. Navigate to
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl\". You should
see the Windows standard GL.h and GLU.h in this directory. Paste glut.h
into this directory.
-
Install glut.lib into the Visual C++ Lib directory. Right click on
glut.lib in the archive you downloaded and select Copy. Navigate to
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\". You should
see the Windows standard OpenGL32.lib and GLU32.lib in this directory,
in addition to a large number of other .lib files. Paste glut.lib
into this directory.
-
Install glut32.dll into the Windows System32 directory. Right click on
glut32.dll in the archive you downloaded and select Copy. Navigate to
"C:\Windows\System32\". You should
see the Windows standard OpenGL32.dll and GLU32.dll in this directory,
in addition to a large number of other .dll files. Paste glut32.dll
into this directory.
The OpenGL programs should now compile and run in Visual C++.
If Windows does not allow you to install glut32.dll in C:\Windows\System32\
right click on the System32\ folder icon, select Properties, and set
permissions appropriately.
If this fails, glut32.dll can be installed in any directory in your Path.
Cygwin on Windows
-
Start your local Cygwin Install program, or
go to http://www.cygwin.com/
and click on the "Install Cygwin now" icon.
-
Assuming that you have g++ already installed, you need to select and
install the following packages:
- opengl
- freeglut
-
OpenGL + GLUT programs should now compile with
$ g++ stdmap-gl.cpp -lopengl32 -lglu32 -lglut32
$ ./a.exe
Macintosh Xcode
-
OpenGL and GLUT are included in Macintosh OS X and work well with Xcode.
There is nothing else to download and install.
-
Create a new project and select "Command Line Utility" -> "C++ Tool" for
the project type.
-
Right click on the project target and "Add Existing Frameworks" to add
the following 3 frameworks:
-
Cocoa.framework
-
OpenGL.framework
-
GLUT.framework
-
Replace main.cpp with your OpenGL program, which should now compile
and run.
Linux
-
In Ubuntu, use the package manager to download and install
libglut3-dev.