Print this page

OpenGL with GLUT

Because OpenGL doesn't provide routines for interfacing with a windowing system or input devices, an application must use a variety of other platform-specific routines for this purpose. The result is nonportable code. Furthermore, these platform-specific routines tend to be full-featured, which complicates construction of small programs and simple demos. GLUT is a library that addresses these issues by providing a platform-independent interface to window management, menus, and input devices in a simple and elegant manner.

Using GLUT on Windows

Installation instructions forĀ  GLUT on Windows can be found in the Internet. See the links below for recommended sites.

Because of an incompatibility between some versions of the MS C++ compiler and the GLUT header file the order of inclusion of stdlib.h and glut.h in the source code is important:

 #include <stdlib.h>
#include <GL/glut.h>

The Visual Studio solution files provided with the GLUT samples have pathnames defined for the compiler include path and the linker library path. To build the sample programs on your computer adjust these settings according to your local GLUT installation.

In order to run the executable GLUT samples the glut32.dll must be installed either in a standard location for libraries or in the same directory from where an executable gets started.

Links to GLUT

GLUT Documentation

GLUT Tutorials

GLUT Alternatives

  • freeglut
    An open-source implementation of the GLUT specification


Previous page: About OpenGL
Next page: The GLUT Samples