OpenGL Setup Windows 7

Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

OpenGL setup for Windows using Windows 7 and Visual Studio 2008 Professional

Install Visual Studio Professional on your PC (free for Duke students)


The below instructions for using GLUT were done with Visual Studio 2008 Professional. I would
encourage you to get 2008 Professional or 2012 Professional. Do NOT get 2013, as it is not a stable build.
http://msdn.microsoft.com/en-us/library/vstudio/dd831853.aspx
Once you have Visual Studio installed you need to get GLUT.
Getting GLUT:
Go to http://user.xmission.com/~nate/glut.html
Download:
glut-3.7.6-bin.zip
make sure you remember where it has been saved on your computer.
unzip the glut-3.7.6-bin.zip file
you will need to know the full path to these files for the following steps, e.g. C:\code\glut\glut-3.7.6-bin

* Note that by default Extract All inserts an extra glut-3.7.6-bin subfolder, e.g. path_to_zip_file\glut3.7.6-bin\glut-3.7.6-bin. Just make sure you use the full path to the folder of the above files in the
subsequent steps.

Add GLUT to your path:


Right-click on Computer, choose Properties
Click on Advanced system settings on the left
Click on Environment Variables at the bottom
Scroll through the System variables at the bottom to find Path
Click Edit

Type the location of the folder where you unzipped glut-3.7.6-bin.zip, followed by a semi-colon, at the
beginning of the Variable value: e.g. C:\code\glut\glut-3.7.6-bin;

Click OK until you have exited System Properties


In Visual Studio
Go to File->New Project
Make sure Project Type is Visual C++->Win32, and Template is Win32 Console Application
Type the name of your project in Name. A folder with this name will be created in Location, so change
this to wherever you want to save your projects, e.g. C:\code\compsci344. Uncheck Create directory for
solution (this would create an extra top-level directory above your project, which we dont need).
Click OK
In the Win32 Application Wizard dialog, click Application Settings
Make sure Console application is selected
Select Empty project
Deselect Precompiled header
Click Finish
To add an existing file to your project
Copy the file (for example, main.cpp) to your project folder in Windows

In Visual Studio, right-click on Source Files in the Solution Explorer in Visual Studio
Select Add->Existing Item, and choose your file (example, main.cpp)
If your file is an OpenGL file (you will complete the following steps for all OpenGL Projects)
Right-click on your project (GlutTest in the above image), and select Properties
Select C/C++, and add your glut directory to Additional Include Directories (See following image)

Select Linker->General and add your glut directory to Additional Library Directories

Select Linker->Input, and add glut32.lib to Additional Dependencies

Under Configuration at the top-left (currently Active (Debug)), select Release, and repeat the steps of
adding the include directory, library directory, and additional dependency for glut.
Click OK

You might also like