Thursday, October 16, 2008

How To Set Up Your Windows PC for OpenGL Programming

These instructions will walk you through the process of setting up a programming environment for creation of 3D programs using OpenGL. In this case, we will be using Microsoft Visual C++ 2008 Express Edition running on a Windows XP system.



Instructions

  1. Download the Microsoft Visual C++ 2008 installer at http://www.microsoft.com/express/download/#webInstall
  2. Run the installer and follow the instructions included. (You do not need to install the optional SQL Server 2008 Express).
  3. Download the OpenGL utility toolkit from http://www.xmission.com/~nate/glut.html
  4. Extract files from the glut-#.#.#-bin.zip file to a folder on your desktop. (If you do not have an archiver, 7-zip is a good free software package for creating and unzipping archives.)
  5. Move the file glut.dll into the directory C:/WINDOWS/system32/
  6. Move the file glut.h into the include directory for Visual Studio 2008. C:/Program Files/Microsoft Visual Studio/VC/include/GL/. (You may need to create the GL folder).
  7. Move the file glut.lib into the lib directory for Visual Studio 2008. C:/Program Files/Microsoft Visual Studio/VC/lib/.
  8. In your source code, include glut.h with the preprocessor code: #include "glut.h"


Troubleshooting

If you receive linker errors during compilation, take the following steps:

  1. Add glut.lib to your additional dependencies. Navigate the menus as follows: Project->Properties->Configuration Properties->Linker->Input.
  2. Enter the text glut.lib into the line labeled "Additional Dependencies."

  3. Add glut.h to your additional include directories. Navigate the menus as follows: Project->Properties->Configuration Properties->Linker->Input.
  4. Click the ellipses button on the right hand side of the text field labeled "Additional Include Directories" and locate the glut.h file you downloaded in steps 3 and 4 of setup.

No comments: