Brillo 2.0 - Production ready 2D graphics
Haskell Community [Unofficial]
March 6, 2026
Hi all, my first post/comment here. I’m learning Haskell, and for other reasons than graphics, but I have, in an earlier life, written an immediate mode OGL renderer, before converting it to OpenGL 3.2 or so.
The main idea is the number of draw calls must be minimized, and that there is a prioritized order of state updates. Data (vertices, colors, other data that can be used by shaders) stored in Vertex Buffer Objects is the cheapest to deal with, these are streamed across the other state (in the GPU). If you can rewrite stuff to instancing, even better.
Then matrices, textures and at last shaders. Absolutely sort drawables by shader. An effect of this is that it is common to make shaders of maximum code size, such that they cover as many use cases as possible.
The basic premise for instancing is that if there are shapes that can be generated (by geometry/tesselation shaders) given just a few datapoints (e.g. position and orientation, texture coordinates, …), you can put out millions of things in a single draw call. I used this for map elements (lines for example).
Discussion in the ATmosphere