1
Fork 0
Multi-Language Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specs. Gabriel's commits.
  • C 63.7%
  • Python 22.9%
  • Rust 5.1%
  • Shell 3.4%
  • CMake 2.7%
  • Other 2.2%
Find a file
Yao Zi cef3f890c4
c: Try loading OpenGL through EGL if GLX isn't available (#536)
On a UNIX system without X11 libraries, it's impossible to have libGL.so
and glXGetProcAddressARB(). Currently GLAD would fail to load GL symbols
in this case.

Try also loading libEGL.so/libEGL.so.1 in OpenGL loader and fallback to
eglGetProcAddress() to query GL symbols if glXGetProcAddressARB() isn't
available.

Since EGL version 1.5 released in 2014, it's required for
eglGetProcAddress() to be able to query all client API functions instead
of only extensions, which is quite early for a Wayland-only display
stack, thus no function check or another fallback logic is added.

Signed-off-by: Yao Zi <me@ziyao.cc>
2026-04-09 08:36:29 +02:00
.github/workflows ci: bump actions versions (#472) 2024-05-31 09:54:05 +02:00
cmake cmake: adds missing CMake vulkan example and removes extra white spaces (#494) 2024-10-17 10:19:13 +02:00
example example: adds SDL3 example (callback main) (#533) 2026-01-31 17:46:58 +01:00
glad c: Try loading OpenGL through EGL if GLX isn't available (#536) 2026-04-09 08:36:29 +02:00
test glad: adds missing vulkan headers 2023-02-17 19:52:58 +01:00
utility utility: use modern version to build package 2024-09-29 12:30:01 +02:00
.gitignore glad: replace setup.py with pyproject.toml (#490) 2024-09-29 11:03:49 +02:00
LICENSE glad: preparations for glad2 release 2022-10-21 18:59:30 +02:00
long_description.md glad: replace setup.py with pyproject.toml (#490) 2024-09-29 11:03:49 +02:00
MANIFEST.in glad: add option to make glad builds reproducible. 2018-09-18 23:19:40 +02:00
pyproject.toml readme: add plugin section 2024-09-29 11:13:23 +02:00
README.md example: adds SDL3 example (callback main) (#533) 2026-01-31 17:46:58 +01:00
requirements.txt glad: bumps jinja2 version to range 2.7-3 2022-03-31 10:23:13 +02:00

glad

Vulkan/GL/GLES/EGL/GLX/WGL Loader-Generator based on the official specifications for multiple languages.

Check out the webservice for glad2 to generate the files you need!

NOTE: This is the 2.0 branch, which adds more functionality but changes the API.

Some languages are only available in the glad1 generator.

Examples

#include <glad/gl.h>
// GLFW (include after glad)
#include <GLFW/glfw3.h>


int main() {
    // -- snip --

    GLFWwindow* window = glfwCreateWindow(WIDTH, HEIGHT, "LearnOpenGL", NULL, NULL);
    glfwMakeContextCurrent(window);

    int version = gladLoadGL(glfwGetProcAddress);
    if (version == 0) {
        printf("Failed to initialize OpenGL context\n");
        return -1;
    }

    // Successfully loaded OpenGL
    printf("Loaded OpenGL %d.%d\n", GLAD_VERSION_MAJOR(version), GLAD_VERSION_MINOR(version));

    // -- snip --
}

The full code: hellowindow2.cpp

More examples in the examples directory of this repository.

Plugins

Glad plugins maintained by the community to add support for more languages:

Documentation

The documentation can be found in the wiki.

Examples can be found in the example directory. Some examples:

License

For the source code and various Khronos files see LICENSE.

The generated code from glad is any of Public Domain, WTFPL or CC0. Now Khronos has some of their specifications under Apache Version 2.0 license which may have an impact on the generated code, see this clarifying comment on the Khronos / OpenGL-Specification issue tracker.