Easy OpenGL Extensions
If you are programming on Linux, you don't need this solution, since
OpenGL extensions are ready for you to use when you include
"glx.h". However, on Windows systems things are not so easy.
The way to access the extension functions is to include "wgl.h" and
then initialize each function that you would like to use separately by
calling wglGetProcAddress
.
Fortunately, there is an easier way! Intel has created GLsdk library just for this purpose. The library has all the necessary information about how to use it. Still, here I will give you the steps you will need to go though:
-
Download GLsdk library.
-
Locate your local include directory. The default include directory of MS Visual Studio is
version 6:
C:\Program Files\Microsoft Visual Studio\VC98\Include version 7.0 (.NET 2002):
C:\Program Files\Microsoft Visual Studio .NET\Vc7\include version 7.1 (.NET 2003):
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include version 8 (.NET 2005):
C:\Program Files\Microsoft Visual Studio .NET 2005\Vc8\include -
Create an OpenGL include directory in your local include directory (if you don't already have it), and name it "GL". This directory is where you will keep all the OpenGL header files.
-
Copy "gl.h", "glext.h", "glprocs.h", "glprocs.c" and "wglext.h" from GLsdk.zip that you downloaded to your OpenGL include directory.
-
Now you are ready to use OpenGL extensions in your code. All you need to do is to include "glprocs.h" in your source files as
#include <GL/glprocs.h>
and compile and link "glprocs.c" with your source files. If you are using MS Visual Studio, simply add "glprocs.c" to your project as a source file; it will take care of the rest.
Note that OpenGL extension support is hardware specific. Therefore, especially if you'd like to use your code on other computers with different hardware, you need to make sure that the extensions you are using are supported. For more information visit SGI's OpenGL SDK page.