OpenGL Guide
  1. 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.

  2. Installation
    1. 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.
    2. Download GLUT for Win32
    3. Unzip the file
    4. Copy glut32.dll into C:/WINDOWS/system32
      You will need administrator access to do this.

  3. 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.

  4. Build Sample application
    Now we should test that this installation and build environment are correct by building a sample application.

    Premade

    1. Download a premade Visual Studio Solution.
    2. Unzip the sample App.
    3. Build and run the sample App.

    From Scratch

    1. Create a new project in the IDE you are using.
    2. Use SampleGlut.cpp for your code.
    3. 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".
    4. Build and run the sample App.


FAQ


What is a .dll file?
On Windows platforms files with the .dll extention are dynamically linked libraries. OS X uses .dylib files, and Linux/Unix use .so files. They hold the definitions to symbols that may be referenced by an appilcation at run-time.

Why are .dll files put in C:/WINDOWS/system32 ?
Because dynamically linked libraries define symbols that are used at run time, the operating system needs to know where to find this files when an application is launched. On windows platforms there are some default directories where these files are searched for. XXXX happens to be one of these default directories were the OS can find dynamically linked libraries.

What is a .lib file?

I'm using a different IDE than Visual Studio?
You will need to look up the documentation for your specific IDE to find out: