UNDER CONSTRUCTION

How To Build the OpenGL Utility Toolkit (GLUT) Library for Win32 using MinGW and MSYS

Downloads:

Outline:

  1. Download and Install MinGW and MSYS
  2. Download and Unzip the GLUT-for-Win32 Source Code
  3. Download the Makefile
  4. Make Two Modifications to the GLUT-for-Win32 Source Code
  5. Make the GLUT for Win32
  6. Install the GLUT for Win32
  7. Test the GLUT for Win32

Procedure:

  1. Download and Install MinGW and MSYS

    NOTE: During the writing of this procedure, version 4.5.0 of gcc and g++ was installed.

    Click here for detailed instructions on how to complete this step.


  2. Download and Unzip the GLUT-for-Win32 Source Code
    ~~~~TODO~~~~

    http://www.xmission.com/~nate/glut.html

    During the writing of this procedure, the following source code was used:
    http://www.xmission.com/~nate/glut/glut-3.7.6-src.zip

    Click here for detailed instructions on how to complete this step.


  3. Download the Makefile
    ~~~~TODO~~~~

    Right click the following link and save the file:
    makefile

    Save the makefile to the root of the unzipped GLUT-for-Win32 folder (i.e. glut-3.7.6/ where the README is located).

    Click here for detailed instructions on how to complete this step.


  4. Make Two Modifications to the GLUT-for-Win32 Source Code

    Make the following modifications:

    1. Add the following lines to include/GL/glut.h starting at line 12:

      #ifdef __MINGW32__
      #define APIENTRY __stdcall
      #define CALLBACK __stdcall
      #endif

    2. Comment out line 21 in lib/glut/win32_winproc.c so that it reads:

      //#include <crtdbg.h>

    Note: After these modifications have been made glut.h and win32_winproc.c should look like the following:
    Click here for detailed instructions on how to complete this step.


  5. Make the GLUT for Win32
    ~~~~TODO~~~~

    In the MinGW Shell (also known as MSYS), cd to the root of the GLUT-for-Win32 folder (i.e. glut-3.7.6/ where the makefile was saved).

    or
    mingw32-make

    This will make glut32.dll and libglut32.a.

    Click here for detailed instructions on how to complete this step.


  6. Install the GLUT for Win32
    ~~~~TODO~~~~

    or
    mingw32-make install

    This will install glut.h in /mingw/include/GL, glut32.dll in /mingw/bin, and libglut32.a in /mingw/lib.

    Click here for detailed instructions on how to complete this step.


  7. Test the GLUT for Win32
    ~~~~TODO~~~~

    or
    mingw32-make test

    This will build and run the gears program in progs/mesademos/. The following window will be produced:


    Click here for detailed instructions on how to complete this step.


Relevant gcc and g++ Flags:

gcc -o filename.exe filename.c -mthreads [-march=cpu-type] [-O3] [-Wall] [-Wextra] [-Werror] [-Iinclude-path] [-Llibrary-path] -lglut32 [-lopengl32] [-lglu32] [-mwindows] [-enable-auto-import]
or
g++ -o filename.exe filename.cpp -mthreads [-std=c++0x] [-ftemplate-depth=n] [-march=cpu-type] [-O3] [-Wall] [-Wextra] [-Werror] [-Iinclude-path] [-Llibrary-path] -lglut32 [-lopengl32] [-lglu32] [-mwindows] [-enable-auto-import]

Troubleshooting:

References:

UNDER CONSTRUCTION