zigNeHe

NeHe OpenGL tutorials, ported to the Zig language.

Stars
22

zigNeHe

The ancient NeHe OpenGL tutorials, ported to the Zig language.

Based largely on the C-based glfw 2 NeHe tutorials by Joseph Redmon (pjreddie@) with updates for glfw 3. Other useful base material from andrewrk/tetris.

The build.zig files work on some versions of MacOS and FreeBSD, as well as Linux (tested on Debian 11-12 and Ubuntu 22.04). With a little effort they should build on other OSes - contributions welcome. Some tweaking of build and c.zig files might be required to build on non-Linux machines.

Requirements

Tested with Zig version 0.11.0.

You will need to install glfw.

MacOS

brew install glfw

On MacOS, you will also need to install XCode in order to get the OpenGL framework.

Debian 11-12

apt install libglfw3-dev libglu1-mesa-dev

Building and running

In each LessonXX directory, you can build and run the given tutorial by running:

zig build run

On MacOS, you may run into linking problems with OpenGL. If this happens try:

ZIG_SYSTEM_LINKER_HACK=1 zig build run

Screenshot

From Lesson 6:

TODO

  • Should do error-handling in a more Zig-like way, and actually deal with gl initialization failing.
  • All the lessons.