DEV Community

Cover image for An underwhelming, but exhilarating, first Leaf SDL-GL pipeline
edA‑qa mort‑ora‑y
edA‑qa mort‑ora‑y

Posted on

4 2

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

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!

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up