Skip to content

ziglibs/zgl

Repository files navigation

ZGL – Zig OpenGL Bindings

This library provides a thin, type-safe binding for OpenGL.

Example

// Use classic OpenGL flavour
varvao=gl.createVertexArray();
defergl.deleteVertexArray(vao);

// Use object oriented flavour
varvertex_buffer=gl.Buffer.create();
defervertex_buffer.delete();

Installation

Add zgl to yourbuild.zig.zonwith the following command:

zig fetch --save https://github /ziglibs/zgl/archive/[commit_hash].tar.gz

Replace [commit_hash] with the latest commit or tagged release.

Then add the following to yourbuild.zig:

constzgl=b.dependency("zgl",.{
.target=target,
.optimize=optimize,
});
exe.root_module.addImport("zgl",zgl.module("zgl"));

Then import it withconst gl = @import( "zgl" );,and build as normal withzig 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 byzig-opengl.Bindings for a different version may be substituted by replacingbinding.zig.