This is an example for how to use mach-glfw and zig-opengl together to create a modern OpenGL 4.1 (latest version supported on macOS) window.
git clone https://github.com/hexops/mach-glfw-opengl-example
cd mach-glfw-opengl-example/
zig build run
This example only clears the screen to a purple color. It doesn't show how to get e.g. triangles onto the screen; you'll need to look at other OpenGL examples for that as a next step. We're happy to accept a PR for this.
zig-opengl provides a binding generator which uses dotnet
to generate pure-Zig OpenGL bindings. We generate and commit them to this repository. The build steps are as follows:
git clone https://github.com/MasterQ32/zig-opengl
cd zig-opengl
dotnet run OpenGL-Registry/xml/gl.xml gl41.zig GL_VERSION_4_1
You can join the Mach discord for help if this example doesn't work. Also consider joining the Zig discord's #gamedev
channel.