GLEW Logo

The OpenGL Extension Wrangler Library

The OpenGL Extension Wrangler Library (GLEW) is a cross-platform open-source C/C++ extension loading library. GLEW provides efficient run-time mechanisms for determining which OpenGL extensions are supported on the target platform.


Download

Visit the GLEW web site for the source code and precompiled binaries.


Features


Compatibility

GLEW is written in ANSI C. You can either include the source files directly into your project or compile them into a separate library.


Usage

To find out if a particular extension is available on your platform, you can check for globally defined variables of the form GLEW_{extension_name}. For example, to check if the ARB_vertex_program extension is available, you can do the following:

#include <GL/glew.h>    /* Replace gl.h with glew.h */
...
if (GLEW_ARB_vertex_program)
{
    /* It is safe to use the ARB_vertex_program extension here. */
    glGenProgramsARB(...);
}

Checking for core OpenGL functionality is similar to checking for extensions. For example, to see if OpenGL 1.3 is supported, you can do the following:

if (GLEW_VERSION_1_3)
{
    /* Yay! OpenGL 1.3 is supported! */
}

Visit the GLEW web site for additional examples and documentation.


Copyright

The source code is licensed under the modified BSD license. The automatic code generation scripts are released under the GNU GPL.


More Information

Visit the GLEW web site for information on new releases, documentation, mailing lists, and project support services.