OpenGL Configuring
Windows:versions:
7 Enterprise
Vista x64 Enterprise Edition SP2 (Build 6002)
Vista Enterprise Edition SP2 (Build 6002)
XP Professional Edition SP3 5.1 (Build 2600)
Visual Studio 2012 version 11.0.51106.01 Update 1
.NET Framework version 4.5.50709
Visual Studio 2010 version 10.0.420219.1 SP1Rel
.NET Framework version 4.0.30319 SP1Rel
Visual Studio 2008 version 9.0.21022.8.RTM
.NET Framework version 3.5 SP1
Installation/verification:
OpenGL comes with the OS and Visual Studio 2012/2010/2008 installations, to verify:
runtime libraries:
C:\Windows\System32\{opengl,glu}32.dll
on 64-bit Windows:
C:\Windows\SysWOW64\{opengl,glu}32.dll
header files:
C:\Program Files\Microsoft SDKs\Windows\v7.1A\Include\gl\{GL,GLU}.h
["Program Files (x86)" for 64-bit Windows; VS2010: v7.0A, VS2008: v6.0A]
linker library:
C:\Program Files\Microsoft SDKs\Windows\v7.1A\Lib\OpenGL32.Lib
["Program Files (x86)" for 64-bit Windows; VS2010: v7.0A, VS2008: v6.0A]
If GLUT is not installed, you can install it by downloading the glut zip file (v. 3.7.6) (web site) and copying its files as follows:
runtime library:
C:\Program Files\Microsoft Visual Studio *\VC\bin\glut32.dll
["Program Files (x86)" for 64-bit Windows; The '*' matches your version of VS: 11.0 for VS2012, 10.0 for VS2010, 9.0 for VS2008]
header file:
C:\Program Files\Microsoft Visual Studio *\VC\include\GL\glut.h
["Program Files (x86)" for 64-bit Windows; You have to create the "GL" directory]
linker library:
C:\Program Files\Microsoft Visual Studio *\VC\lib\glut32.lib
["Program Files (x86)" for 64-bit Windows]
If you don't have a VC folder, try instead:
runtime library:
C:\Windows\system\glut32.dll
header file:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Include\GL\glut.h
["Program Files (x86)" for 64-bit Windows; VS2008: v6.0A]
linker library:
C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\glut32.lib
["Program Files (x86)" for 64-bit Windows; VS2008: v6.0A]
Or you may choose to install freeglut for Windows.
Later in your OpenGL source files, include the following line:
#include <GL/glut.h>
You don't need to include gl.h and glu.h, as they are already included in glut.h.
For an example, see the provided sample source code.
Command line make: see the instructions for Cygwin below.
Visual Studio 2012/2010/2008 project (graphical step-by-step, all the screen shots are from VS2008, but are applicable to the newer versions):
Create a new project:
Select "File→New→Project" (Fig. 26)
Choose a template for your new project:
"Visual C++→Win32→Win32 Console Application", give the project a name, e.g., "sampleapp" and click "OK" (Fig. 27)
On the "Welcome to the Win32 Application Wizard" page, click "Next >" (Fig. 28)
On the "Application Setting" dialog box, under "Additional options" tick "Empty project", then click "Finish" (Fig. 29)
Add source files:
Right click on your project, for example, "sampleapp", on the third (second) line of the "Solution Explorer" pane on the right (left) to "Add→Existing Item" (Fig. 30),
select your source and header file(s), for example, the provided sample.c, and click "Add"
Add libraries:
Right click on "sampleapp" again and select "Properties" to tell the linker which libraries need to be added (Fig. 31)
On the "Property Pages", under "Configuration:" tell VS to add the additional libraries to "All Configurations" (Fig. 32)
Select "Configuration Properties→Linker→Input" on the left pane, and enter:
opengl32.lib;glu32.lib;glut32.lib;
[VS2008: with spaces in place of the semicolons]
as "Additional Dependencies" on the top of the right pane, hit RETURN and then click "Apply" (Fig. 33).
Optional:
To prevent your program from opening a console window, while still on the "Property Pages",
select "Configuration Properties→Linker→Command Line" on the left pane, and enter:
/SUBSYSTEM:WINDOWS /ENTRY:mainCRTStartup
as "Additional options" at the bottom of the right pane, then click "Apply" (Fig. 34)
You may not want to disable the console window if you print out messages to the console (see next step).
Close the "Property Pages" pane by clicking "Ok", then click on the play button on the second menu bar ( )
to build and run the program. If you print out messages to the console, run the program using Ctl-F5 instead,
to keep the cmd window from exiting after the program exits.
To distribute your program, include glut32.dll with your distribution as it's most likely not installed on most Windows systems.
No comments:
Post a Comment