Lazy Foo' Productions

Now celebrating Lazy Foo' Productions' 10dec year anniversary!

Setting up freeGLUT on Visual Studio 2010 Ultimate

Last Updated 11/22/12
1)First thing you need to do is download freeGLUT headers and binaries. You will find them on the freeGLUT website, specifically on this page.

Scroll down to the Prepackaged Releases section and click on the prepackaged windows binaries page.

Then download the Visual Studio binaries archive.

Open the zip archive and there should be a folder called "freeglut". Copy that entire folder and put it anywhere you'd like. For these tutorials I'm putting it in a directory I created called C:\vs_dev_lib

2)Start up Visual Studio and create a new empty project.

3)Go to project properties.

4)Now we have to tell Visual C++ to search for header files in the freeglut folder we just extracted. Under Configuration Properties in the VC++ Directories menu, select the Include Directories field, click the tiny down arrow button, and click edit.

5)Click the folder icon, and then click the button that pops up.

6)Now go find the freeGLUT folder you extracted, and select the include folder

and click OK.

7)Next we going to tell Visual C++ to search for library files in the freeglut folder we just extracted. Select the Library Directories field, click the tiny down arrow button, and click edit.

8)Click the folder icon, and then click the button that pops up.

9)Now go find the freeGLUT folder you extracted, and select the lib folder

and click OK.

10)In order to compile OpenGL and freeGLUT code, we have to tell the Visual C++ to link against the libraries. Go under Linker in the Input menu, edit the additional dependencies.

11)Now paste
OpenGL32.lib;
freeglut.lib;
into the Additional dependencies field and click OK.

12)Under Linker in the System menu, set the subsystem.
I recommend setting it to windows if you don't want console output, and console if you do want console output. Note: if you do set it to windows, you have to define the entry point. To do that go to Advanced under the Linker menu and set the Entry Point field to mainCRTStartup. This sets it so your program will use
int main( int argc, char* args[] ) as your main.
As the starting point for your program.

13)When our OpenGL/freeGLUT application runs, the operating system needs to be able to find the dll file.

Go find the freeGLUT folder you extracted and from the bin folder inside copy freeglut.dll and put it either where your executable will run, or inside of the system directory. C:\WINDOWS\SYSTEM32 is the 32bit windows system directory and C:\Windows\SysWOW64 is the 64bit system directory of 32bit applications. For these tutorials, I'm assuming we're making 32bit applications.

14)Now go download the source for lesson 01. Add the source files inside to your project.

Now build. If there are any errors, make sure you didn't skip a step.

Now that you have OpenGL and freeGLUT compiling, it time to go onto part 2 of the tutorial.
The documentation for OpenGL can be found here.
The documentation for GLUT (the API freeGLUT is based on) can be found here.
The documentation for freeGLUT can be found here.

Hello OpenGL Part 2: Your First Polygon