Intro to gfx-hal • Graphics programming in Rust

2020-03-31 · Learning gfx-hal

If you’re interested in Rust, and you’re interested in graphics programming, then there’s a decent chance you’ve heard of gfx-rs. You may also have heard of gfx-hal - a complete rewrite of the library at a much lower level.

The hal in the name stands for Hardware Abstraction Layer and it serves as a way to provide support for cross-platform graphics. The gfx-hal API itself is based on Vulkan, but it supports multiple backends so that the graphics code you write can be translated to Vulkan, DirectX, Metal, and others, with no (or minimal) changes.

If you’re looking for the simplest way to render 3D things on your screen - this probably isn’t it. But if you’re looking for fine-grained control, predictable performance, and an explicit (if verbose) API - then you’ve come to the right place.

Or hey, even if you’re just curious! That’s why I’m learning it!

By this point, either I’ve convinced you or you’ve already left, and so I can introduce the 10 part gfx-hal tutorial I’m working on.

I’ve attempted this before - but I did so in a way that was extremely hard to maintain, especially since gfx hadn’t even hit v0.1.0 yet. Now, with a bit more forward planning (and some inspiration from Tomas Sedovic’s excellent Roguelike Tutorial) I feel much more confident.

Each entry in the series will focus on one specific feature (except Part 1 which is a bit of a monster). I’ll do my best to keep them well commented and well explained, and - where possible - linear, so you can read them top-to-bottom more easily.

Now you can either start reading Part 1 or look at the full series of entries, which will be updated roughly once every two weeks (or sooner, if I can manage it).

I’d also like to express how grateful I am for the many other great resources for graphics programming out there, without which I wouldn’t be able to make this tutorial at all. Some specific highlights I’d recommend are:

With that said, I hope you enjoy learning A New Thing, and use that knowledge to make many pretty pictures.