Home
Up
Account / Password
VC++ with GLUT/GLUI
vuVolume Notes
Doxygen
SSH,  SCP & FTP
Tmake
Tar & gzip
CVS & vuVolume
KDEvelop
Important Directories
Misc

Notes:

Quick Microsoft Visual C++ Tutorials with GLUT/GLUI:

Important Notes Before You Begin:

  • VC++ will not work properly with *.c files. You MUST rename them to *.cpp files.
     

  • If you are new to OpenGL, this site has some great tutorials: http://nehe.gamedev.net. However, for portability reasons, do NOT create OpenGL programs as Win32 applications.
     

  • Test your program often, both on Windows and Linux/Unix platforms.
     

  • VC++ has some special keywords like "near", "far", "LONG" (but they are not highlighted), just to name a few that I encountered. If you used such variables in your code, you may get funky errors.
     

  • Arrays has to be copied; array assignment will not work in VC++ (though it works in Unix/Linux). For example:

    a[3] = {1,2,3};
    b[3] = {3,2,1};
    b = a; //ERROR!

    Instead, you can write a function, copyArrays(a1, a2, numElements).

Installation Option 1:

  • Right click to download glut.h to:

    C:\Program Files\Microsoft Visual Studio\VC98\Include\GL\glut.h
     

  • Right click to download glui.h to:

    C:\Program Files\Microsoft Visual Studio\VC98\Include\GL\glui.h
     

  • Right click to download glut.lib to:

    C:\Program Files\Microsoft Visual Studio\VC98\Lib\glut.lib
     

  • Right click to download glut32.lib to:

    C:\Program Files\Microsoft Visual Studio\VC98\Lib\glut32.lib
     

  • Right click to download glui32.lib to:

    C:\Program Files\Microsoft Visual Studio\VC98\Lib\glui32.lib
     

  • Right click to download glut.dll to:

    C:\WINNT\system32\glut.dll (for Windows NT/2000) OR

    C:\WINDOWS\system32\glut.dll (for Windows 95/98/Me/XP)
     

  • Right click to download glut32.dll to:

    C:\WINNT\system32\glut32.dll (for Windows NT/2000) OR

    C:\WINDOWS\system32\glut32.dll (for Windows 95/98/Me/XP)

Installation Option 2:

  • Download the latest versions of GLUT and GLUI by searching online.
     

  • Download the latest version of GLUT under the heading "GLUT for Microsoft Windows 9X, ME, 2000, NT & XP users".
    Copy the unzipped files to the directories specified in "Installation Option 1".

Installation Option 3:

  • You may also decide to recompile the source code for yourself. In that case, instructions are similar to Option 2.
     

  • If you choose this option, make sure you read the readme.txt file in the zip files that you download.

If you installed GLUT and GLUI in a directory other than those described in Option 1:

  • Tools -> Options -> Directories -> Show Directories For:

    Include Files: add the directory where the folder "GL" is located
    Library Files: add the directory where you saved the *.lib files.

Running a simple OpenGL program in VC++:

  • File -> Open any single-file program that uses GLUT. A sample [square.cpp] file has been provided. [Note: this doesn't seem to work on some systems. I'll have to look into it.]
     

  • Build -> Compile square.cpp
     

  • VC++ will ask you about creating a default project space. Click yes.
     

  • Project -> Settings -> Settings for "All Configurations" [drop down selection at left top corner of window] -> Links [one of the tabs] -> Object/Library Modules: add the following before "kernel32.lib":

    glui32.lib glut32.lib glu32.lib opengl32.lib glaux.lib
     

  • Build -> Build square.exe
     

  • Build -> Execute square.exe
     

  • Perform the above again with [example1.cpp], which is bundled with the GLUI source files. [Note: change #include "glui.h" to #include <GL/glui.h>]

Running a project in VC++:

  • Download and unzip [taitris2D.zip] (removed).
     

  • [Note: close any open workspaces.] File -> Open: taitris.cpp
     

  • Build -> Compile. Click yes to create a default project space. [Note: there should not be any errors.]
     

  • Project -> Add to Project -> Files: mass-select [one way is CTRL+A] all *.cpp and *.h files and click OK
     

  • You will get a warning saying taitris.cpp cannot be added. That's because it already is added.
     

  • Build -> Build taitris.exe
     

  • Build -> Execute taitris.exe
     

  • A Tetris game should now be running, click on Help if you want to play the game. (Note: some GLUI control do not work, because the game that I have uploaded is not the final version.)

Tai Meng | 孟泰 | Last Updated: May 01, 2013