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.
This source tree has some example code modified for my purposes.
I've been looking for a simple example program that works well with the EGL/X11 combination for a long time and finally found the glad project. egl_x11 was originally a combination of EGL/OpenGL ES, but he rewrote it to work with EGL/OpenGL 2.1.
#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.
The documentation can be found in the wiki.
Examples can be found in the example directory. Some examples:
- C/C++
- Rust
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.