OpenGL Development Environment Configuration
Floating white clouds
Http://blog.csdn.net/kesalin
(Indicate the author and source when reprinting. Do not use it for commercial purposes without permission)
OpenGL has some reusable auxiliary libraries, such as glut, Glee, and glew. You need to install them on your own on the Windows platform, because Microsoft wants to promote its DX, only OpenGL 1.1 is supported in windows. You can open/Microsoft Visual Studio X. x/VC/include/Gl/GL. h or/Microsoft sdks/Windows/v6.1/include/Gl/GL. h file. Check that the default supported OpenGL version is:
/* Version */
# Define gl_version_1_1 1
Now OpenGL has grown to 3.0, so we need to download and configure these libraries by ourselves. Here we will install the glut, Glee, and glew libraries and some OpenGL extension support.
GLUT: Provides window encapsulation. This is a cross-platform window, so we don't have to write tedious window code on our own.
Glee: it is easy to judge whether the current system supports a certain OpenGL feature. We don't have to write the tedious code that gets the function address first and then judges it.
Glew: Windows only supports OpenGL 1.1 by default. To use a later version of OpenGL, you need to install it. It can automatically identify all OpenGL advanced extension functions supported by your platform.
1. Install glut
Glu3.7: http://www.opengl.org/resources/libraries/glut/glutdlls37beta.zip
Click the link above to download the latest glut. The latest version of glut is 3.7. decompress the package and unzip the glu32.dll and glut. DLL to C:/Windows/system32. copy the Lib file to the lib directory under the VC installation directory (for example,/Microsoft Visual Studio 9.0/VC/lib. copy H to the/include/Gl/directory under the installation directory of VC (for example,/Microsoft Visual Studio 9.0/VC/include/Gl ). In the program, we only need
# Include <Gl/Gl. h>
# Include <Gl/Glu. h>
Use
# Include <Gl/glut. h>
You can replace it. Because the glut. h header file already contains these header files and the necessary libraries are imported:
# Pragma comment (Lib, "winmm. lib")/* link with Windows multimedia lib */
# Pragma comment (Lib, "opengl32.lib")/* link with Microsoft OpenGL lib */
# Pragma comment (Lib, "glu32.lib")/* link with OpenGL utility lib */
# Pragma comment (Lib, "glu32.lib")/* link with Win32 glut lib */
2. Install glew
Download link: https://sourceforge.net/project/downloading.php? Group_id1_67586&filename=glew-1.5.1-win32.zip
Click the link above to download the latest glew (OpenGL 3.0 is supported), decompress it, and copy/bin/glew32.dll to C:/Windows/system32, copy/lib/glew32.lib to the lib directory under the VC installation directory (for example,/Microsoft Visual Studio 9.0/VC/lib/) and/include/glew. H and/include/wglew. copy H to the/include/Gl/directory under the installation directory of VC (for example,/Microsoft Visual Studio 9.0/VC/include/Gl ). In the program, we only need to include GL, Glu or glut. h contains glew. h. (Note: glew must be included first. h), add the following sentence in the Code:
# Pragma comment (Lib, "glew32.lib ")
Example:
# Include <Gl/glew. h>
# Include <Gl/glut. h>
# Progrma comment (Lib, "glew32.lib ")
After creating the OpenGL rendering context, callGlewinit ();Initialize glew.
3. Install glee
Glee home: http://elf-stone.com/glee.php
Download link: http://elf-stone.com/getfile.php? Title = glee
Click the link above to download the latest Glee, decompress it, and download glee. copy lib to the lib directory under the VC installation directory (for example, under/Microsoft Visual Studio 9.0/VC/lib/) and change glee. copy H to the/include/Gl/directory under the installation directory of VC (for example,/Microsoft Visual Studio 9.0/VC/include/Gl ). In the application, we can use it as follows:
# Include <Gl/Glee. h>
# Progrma comment (Lib, "glee. lib ")
If (glee_arb_multitexture) // is multitexture support available?
{
Glmultitexcoord2farb (...); // safe to use multitexture
}
Else
{
// Fallback
}
4. install some extension support
Download these three files Glext. h, Glxext. h, And Wglext. hTo the/include/Gl/directory under the VC installation directory (for example,/Microsoft Visual Studio 9.0/VC/include/Gl ). You can simply include them when using them.