How To Use extgl.h
I got this from extgl
Its only a few steps to setup the compiler to use my lib.
- Add extgl.h and extgl.c to your project
- Replace #include <GL/gl.h> with #include <extgl.h>
- In your program, after creating the rendering context, call extgl_Initialize() function. It should return 0, if it returns not 0 please contact me.
Thats it, now you can use OpenGL 1.2, 1.3, 1.4 and extensions just like any other OpenGL function. Of course only if the features are supported by your driver.
To query if the given extension is supported by the driver you can use a structure extgl_Extensions. You can use it like this:
...
if (!extgl_Extensions.ARB_vertex_program)
{
printf("ARB_vertex_program extension not found\n");
...
}
...
This structure is initialized in the extgl_Initialize() call, so don't use the structure before extgl_Initialize(). The members of the structure are all extensions listed above and these 3 flags:
OpenGL12 OpenGL13 OpenGL14
With them you can do following:
...
if (extgl_Extensions.OpenGL13)
{
glActiveTexture(GL_TEXTURE0);
}
else
if (extgl_Extensions.ARB_multitexturing)
{
glActiveTextureARB(GL_TEXTURE0_ARB);
}
...
You can also use the following function to check if the extension is supported by extgl:
void extgl_ExtensionSupported(const char *name)
To query if a given WGL extension is available you can also use the extgl_Extensions structure. It has a member called "wgl":
...
if (extgl_Extensions.wgl.ARB_render_texture)
{
do something with
the WGL_ARB_render_texture extension
}
...