Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A python script for generating OpenGL extension and core profile loaders.

branch: master

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 profiles
Octocat-spinner-32 templates
Octocat-spinner-32 .gitignore
Octocat-spinner-32 COPYING


flextGL is an OpenGL extension loader generator.

It is a bit different than other comparable systems:

  • Gives complete control over exposed version and extensions
  • (Optionally) exports only core-profile functions
  • Only requested extensions are loaded
  • Bindings directly generated from *.spec files
  • Flexible python template system for source-generation
  • Source templates easy to adapt to project requirements

You will need the following dependencies:

What's new?

This new version is a major rewrite that should make the spec parser quite a bit more manageable.

Added support for Python 3 and replaced Cheetah with Wheezy for templating.

Source tree


    The generator script.

  • templates/

    The sub-directories in here contain the different template sets. You can add your own template by simply creating a new folder in there.

  • profiles/

    Some example profile files to give you an idea on how to write your own. 'profiles/exampleProfile.txt' contains a lot of comments to get you up to speed.

  • spec/ (generated)

    This directory is automatically created by the script to store the downloaded OpenGL .spec files.


You create your loader code by writing a profile file and passing it to the script.

Here is what a typical profile might look like:

version 3.3 core
extension EXT_texture_filter_anisotropic optional
extension ARB_tesselation_shader optional

This requests an OpenGL core profile and the extensions for anisotropic filtering and tesselation shaders. Those extensions were requested as 'optional'. This means that a missing extension won't cause an error. Instead, the programmer will have to check before using it. This can be easily done by testing a generated global variable.

The profile file is then passed to the script like this:

$ python -D generated profile.txt

This will create the requested source code and put it in the 'generated' directory.

The best way to work with flextGL is to integrate it in your build-system. You can find a small example program that demonstrates this for Make and CMake The example project demonstrates this for Make and CMake here.

Generated API

The generated API boils down to a few things:

  • int flextInit()

    Initializes the OpenGL functions after context creation.


    The OpenGL major version defined in the profile file.


    The OpenGL minor version defined in the profile file.


    Boolean variable. Is GL_TRUE, if the profile file defined a core profile.

  • FLEXT_<extension-name>

    Generated global variables for checking if a specific extension is supported.

Take a look at the example program to get an idea on how it's used.


At the moment, there are two template sets available:

  • 'compatible'

    This loads the extensions using a framework-agnostic method with WGL AGL or GLX. This is probably the sensible default for most people. It has not been thoroughly tested yet, though.

  • 'glfw'

    This uses GLFW 2's functions for loading and testing for OpenGL extensions. It will obviously only work with GLFW, but is well tested and the generated source code is very easy to understand.

  • 'glfw3'

    This works like the glfw template, but uses GLFW 3 instead. In this template, a pointer to the GLFWwindow has to be passed as a parameter of flextInit().

Installing Wheezy Template on Windows

The simplest way to install Wheezy Template on Windows is to install the Setuptools replacement distribute by downloading and extracting the distribute-*.tar.gz package and running using Python 3.2.

This will install the Setuptools scripts in C:\python32\Scripts. Add this folder to your path and call the following command in an Administrator commandline:

easy_install.exe wheezy.template

You should now be able to run flextGLgen.


The "compatible" template uses a few code snippets from Slavomir Kaslev's gl3w OpenGL core profile loader for portable loading of procedures and checking minor/major version in OpenGL < 3.0.

(C) Thomas Weber, 2011
    ginko (at) cg (dot) tuwien (dot) ac (dot) at
Something went wrong with that request. Please try again.