Galogen is an OpenGL loader generator. Given an API version and a list of extensions, Galogen will produce corresponding headers and code that load the exact OpenGL entry points you need. The produced code can then be used directly by your C or C++ application, without having to link against any additional libraries.
Galogen uses the Khronos OpenGL Registry as its source of truth, thus ensuring that the produced code always corresponds to the latest specifications.
Galogen runs on Windows and Linux. It also runs in the browser, thanks to Emscripten. The generated loading code works on Windows and Linux.
Contacting the Author
Please file bugs and feature requests on GitHub.
Prebuilt x86_64 binaries of Galogen are available for Windows and Linux.
- Zip archive for Windows x86_64 (SHA1: 576298ec956b297b6f7af7546d3bd9a11b2b3240)
- Zip archive for Linux x86_64 (SHA1: ca81206f97a9c07767abb086daae8669397ed6cc)
In case you use other platforms, building from source is quick and easy:
- Get the source code on GitHub
- To build with g++, run the following command:
g++ galogen.cpp third_party/tinyxml2.cpp --std=c++11 -O3 -o galogen
- To build with MSVC, run the following from the Visual Studio
cl galogen.cpp third_party/tinyxml2.cpp /Ox /EHsc
To run Galogen, you will need the OpenGL API registry, which is a single XML file. A copy of it comes with the prebuilt binaries, as well as with the source code distribution. If you would like to use the most up-to-date version, please obtain it from Khronos' official GitHub repo.
You may also consider using the in-browser version of Galogen.
Generating a Loader Using The Command-Line Version
Run Galogen from the command line like so:
galogen <path to the API registry XML file> <options>
The latest version of the API registry file can be obtained from Khronos' official GitHub repository.Supported options:
- --api - should be "gl" for OpenGL, "gles1" for OpenGL ES 1, or "gles2" for OpenGL ES 2 or 3.
- --ver - version of the API, e.g. 4.5 for OpenGL 4.5. Default is 4.0 for desktop OpenGL, 2.0 for OpenGL ES.
- --profile - which API profile to use. Set to "core" for core profile, "compatibility" for compatibility profile. Default is "compatibility".
- --exts - comma-separated list of extensions to add.
- --filename - name for generated file(s). Default is "gl".
As an example, the following command will generate code for
loading OpenGL 4.3 core with anisotropic texture filtering
extension and write it to files named "gl43.h" and "gl43.c":
galogen gl.xml --api gl --version 4.3 --profile core --exts EXT_texture_filter_anisotropic --filename gl43
Using the Loader Code in Your Application
You may simply drop the generated files into your C++ or C project and use them directly. You do not need to include the system GL headers: simply including the Galogen-generated header file is sufficient, as it has all the necessary declarations.
Note that you still need to link against opengl32.lib on Windows, and against libGL on Linux.
Galogen is developed and maintained by nicebyte.
TinyXML2 library by Lee Thomason.