Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ziglibs/zgl
Zig OpenGL Wrapper
https://github.com/ziglibs/zgl
bindings zig zig-package ziglang
Last synced: 6 days ago
JSON representation
Zig OpenGL Wrapper
- Host: GitHub
- URL: https://github.com/ziglibs/zgl
- Owner: ziglibs
- License: mit
- Created: 2020-07-03T13:19:40.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-21T06:46:56.000Z (4 months ago)
- Last Synced: 2024-11-30T01:04:45.382Z (13 days ago)
- Topics: bindings, zig, zig-package, ziglang
- Language: Zig
- Homepage:
- Size: 319 KB
- Stars: 431
- Watchers: 8
- Forks: 64
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - ziglibs/zgl
- awesome-zig - zgl🗒️Zig OpenGL Wrapper
README
# ZGL – Zig OpenGL Bindings
This library provides a thin, type-safe binding for OpenGL.
## Example
```zig
// Use classic OpenGL flavour
var vao = gl.createVertexArray();
defer gl.deleteVertexArray(vao);// Use object oriented flavour
var vertex_buffer = gl.Buffer.create();
defer vertex_buffer.delete();
```## Installation
Add zgl to your `build.zig.zon` with the following command:
`zig fetch --save https://github.com/ziglibs/zgl/archive/[commit_hash].tar.gz`
Replace [commit_hash] with the latest commit or tagged release.
Then add the following to your `build.zig`:
```zig
const zgl = b.dependency("zgl", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("zgl", zgl.module("zgl"));
```Then import it with `const gl = @import("zgl");`, and build as normal with `zig build`.
## Development Philosophy
This library is developed incrementally. That means that functions and other things will be included on-demand and not just for the sake of completeness.
If you think a function is missing, fork the library, implement the missing function similar to the other functions and make a pull request. Issues that request implementation of missing functions will be closed immediatly.
## Generated Bindings
This library includes OpenGL 4.5 bindings, generated by [zig-opengl](https://github.com/MasterQ32/zig-opengl). Bindings for a different version may be substituted by replacing [binding.zig](src/binding.zig).