Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zig-gamedev/zopengl
OpenGL loader and bindings for Zig.
https://github.com/zig-gamedev/zopengl
gamedev opengl opengl-bindings opengl-loader opengl-wrapper opengles zig
Last synced: 28 days ago
JSON representation
OpenGL loader and bindings for Zig.
- Host: GitHub
- URL: https://github.com/zig-gamedev/zopengl
- Owner: zig-gamedev
- License: mit
- Created: 2024-11-03T23:34:16.000Z (about 2 months ago)
- Default Branch: main
- Last Pushed: 2024-11-23T23:56:08.000Z (28 days ago)
- Last Synced: 2024-11-24T00:25:24.147Z (28 days ago)
- Topics: gamedev, opengl, opengl-bindings, opengl-loader, opengl-wrapper, opengles, zig
- Language: Zig
- Homepage:
- Size: 64.5 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [zopengl](https://github.com/zig-gamedev/zopengl)
OpenGL loader, bindings and optional wrapper for Zig.
Supports:
* OpenGL Core Profile up to version 4.2
* OpenGL ES up to version 2.0## Getting started
Example `build.zig`:
```zig
pub fn build(b: *std.Build) void {
const exe = b.addExecutable(.{ ... });const zopengl = b.dependency("zopengl", .{});
exe.root_module.addImport("zopengl", zopengl.module("root"));
}
```Now in your code you may import and use `zopengl`:
```zig
const zopengl = @import("zopengl");pub fn main() !void {
// Create window and OpenGL context here... (you can use our `zsdl` or `zglfw` libs for this)try zopengl.loadCoreProfile(getProcAddress, 4, 0);
const gl = zopengl.bindings; // or zopengl.wrapper (experimental)
gl.clearBufferfv(gl.COLOR, 0, &[_]f32{ 0.2, 0.4, 0.8, 1.0 });
}fn getProcAddress(name: [:0]const u8) ?*const anyopaque {
// Load GL function pointer here
// You could use `zsdl.gl.getProcAddress() or `zglfw.getProcAddress()`
}
```