aka: why did my GUI library just yeet my transform matrix
One thing I've noticed as I've been writing some games/libraries with Tetra, is that it's quite hard to build rendering abstractions that don't leak into the global rendering state.
It would be good to add something to the API that would let you push/pop graphics state changes. There's a similar API in a lot of engines I've used (most notably Love2D), and it ends up being pretty convenient.
In the past I've said I wouldn't implement this because it's possible to do in user-space, but that doesn't take into account the fact that code you don't control (e.g. third party libraries) can't benefit from that.
Motivation/Examples
In one of my game projects, I have a piece of code that wants to draw to a canvas, and then switch back to whatever canvas was previously bound. At the moment, this means you have to pass the canvas in, which makes things a bit more unwieldy.
I'm working on an imgui renderer for Tetra, and this requires me to set the scissor rectangle and blend modes to ensure correct rendering. Again, if I want to be able to leave the state how I found it, I'd have to make the API consumer pass it in, which feels a bit gross.
Summary
aka: why did my GUI library just yeet my transform matrix
One thing I've noticed as I've been writing some games/libraries with Tetra, is that it's quite hard to build rendering abstractions that don't leak into the global rendering state.
It would be good to add something to the API that would let you push/pop graphics state changes. There's a similar API in a lot of engines I've used (most notably Love2D), and it ends up being pretty convenient.
In the past I've said I wouldn't implement this because it's possible to do in user-space, but that doesn't take into account the fact that code you don't control (e.g. third party libraries) can't benefit from that.
Motivation/Examples
Alternatives Considered