loading...
Cover image for An underwhelming, but exhilarating, first Leaf SDL-GL pipeline

An underwhelming, but exhilarating, first Leaf SDL-GL pipeline

mortoray profile image edA‑qa mort‑ora‑y ・1 min read

It may not be pretty, but this represents a significant step forward in the Leaf project. Enough to start live game programming -- follow me there to watch.

Points of interest:

  • This demo is written in Leaf. You can see the, still somewhat scary, main file over here.
  • I'm using libSDL2 to create the window and initialize OpenGL.
  • It does handle window and keyboard events, this required some compiler changes to support the SDL C-union types (needed an unsafe cast「T」(expr) operator).
  • I'm using GL vertex and fragment shaders with just a couple of vertex attributes and uniforms.
  • Sending data to GL required an introduction of a array.raw_ptr member to get raw access to memory addresses in Leaf.
  • I fixed numerous bugs in the compiler, including many improved error messages. Though "duplicate-symbol" reporting is still an issue (no location!).
  • Fixed a rather major alloca issue that caused memory exhaustion. Otherwise this appears to be perfectly stable now.

This sets me up to start doing minimal games programming on my stream. My goal is to explore some of the algorithms I'm using on the Evening Rust stream, expand the language, and have some fun while doing it. It'll be a rough journey, but you're welcome to join!

Posted on by:

mortoray profile

edA‑qa mort‑ora‑y

@mortoray

I'm a creative writer and adventurous programmer. I cook monsters.

Discussion

markdown guide