Simple OpenGL core profile loading
Switch branches/tags
Nothing to show
Clone or download
Latest commit 4f1d558 Oct 10, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake Add install rules Jul 3, 2018
src Fixed gcc -pedantic warning. Jul 6, 2017
.gitignore Tweaked .gitignore Sep 3, 2014
CMakeLists.txt Add install rules Jul 3, 2018
README.rst Distinguish errors that can occur during init Jul 19, 2017
SConstruct Use dlopen/dlsym/dlclose on macOS too. Jul 8, 2017
UNLICENSE Create UNLICENSE Jan 23, 2015 Code style tweaks Oct 10, 2018
public-domain-mark.png Added public domain mark. Feb 16, 2017


gl3w: Simple OpenGL core profile loading


gl3w is the easiest way to get your hands on the functionality offered by the OpenGL core profile specification.

Its main part is a simple Python script that downloads the Khronos supported glcorearb.h header and generates gl3w.h and gl3w.c from it. Those files can then be added and linked (statically or dynamically) into your project.

Requirements requires Python version 2.7 or newer. It is also compatible with Python 3.x.


Here is a simple example of using gl3w with glut. Note that GL/gl3w.h must be included before any other OpenGL related headers:

#include <stdio.h>
#include <GL/gl3w.h>
#include <GL/glut.h>

// ...

int main(int argc, char **argv)
        glutInit(&argc, argv);
        glutInitDisplayMode(GLUT_RGBA | GLUT_DEPTH | GLUT_DOUBLE);
        glutInitWindowSize(width, height);


        if (gl3wInit()) {
                fprintf(stderr, "failed to initialize OpenGL\n");
                return -1;
        if (!gl3wIsSupported(3, 2)) {
                fprintf(stderr, "OpenGL 3.2 not supported\n");
                return -1;
        printf("OpenGL %s, GLSL %s\n", glGetString(GL_VERSION),

        // ...

        return 0;

API Reference

The gl3w API consists of just three functions:

int gl3wInit(void)

Initializes the library. Should be called once after an OpenGL context has been created. Returns 0 when gl3w was initialized successfully, non-zero if there was an error.

int gl3wIsSupported(int major, int minor)

Returns 1 when OpenGL core profile version major.minor is available and 0 otherwise.

GL3WglProc gl3wGetProcAddress(const char *proc)

Returns the address of an OpenGL extension function. Generally, you won't need to use it since gl3w loads all functions defined in the OpenGL core profile on initialization. It allows you to load OpenGL extensions outside of the core profile.



gl3w is in the public domain. See the file UNLICENSE for more information.


Slavomir Kaslev <>
Initial implementation
Kelvin McDowell
Mac OS X support
Sjors Gielen
Mac OS X support
Travis Gesslein
Patches regarding glcorearb.h
Arthur Tombs
Port to Python 3
Daniel Cousens []
Code contributions


OpenGL is a registered trademark of SGI.