rlsw – Raylib software OpenGL renderer in less than 5k LOC
19 comments
·October 21, 2025ciroduran
smlacy
but ... why?
zamadatix
The mantra for the library is "raylib is a simple and easy-to-use library to enjoy videogames programming." It's for hobbyist, learners, tinkerers, or just those that want to enjoy minimalistic graphics programming without having to deal with interfacing with modern machines yourself.
The default Windows installer bundles the compiler and a text editor to make poking at C to get graphics on the screen (accelerated or not) a 1 step process. Raylib is also extremely cross platform, has bindings in about every language, and has extra (also header only, 0 dependency) optional libraries for many adjacent things like audio or text rendering.
When I first started to learn C/C++ in the 2000s I spent more time fighting the IDE/Windows/GCC or getting SDL/SFML to compile than I did actually playing with code - and then it all fell apart when I tried to get it working on both Linux and Windows so I said fuck it and ignored that kind of programming for many years. Raylib is about going the opposite direction - start poking at C code (or whatever binding) and having it break and worry about the environment later when you're ready for something else.
foota
As someone who was once a child trying to figure out how to compile and link things to use SDL, I think there's some educational value in letting people make games without having to dive deep into how to use C++ toolchains.
SJC_Hacker
If you want to do that, skip C++ entirely and just use Javascript or Python. You can get shiny things really quickly.
null
Archit3ch
> OpenGL 1.1-style implementation on software
How many lines to implement OpenGL 2.0 (non ES) ?
Pannoniae
An order of magnitude more ;) You need to implement user-programmable shaders, both ARB assembly and GLSL. That needs a GLSL parser, a shader interpreter (talking about compiling it to machine code would add another magnitude of complexity).
You also need to implement multitexturing (probably the easy part) but also all the texture combiner stuff too. This one is not hard but also a good chunk of code...
All in all, at least 40K if you ask me, but that's a very lowball estimate.
Of course if you don't care about implementing the full spec, you can get away with a lot less.
bsder
Fabrice Bellard also wrote an OpenGL thing: https://bellard.org/TinyGL/
brcmthrowaway
Does this support CUDA?
Pannoniae
No, this is CPU rendering only! Not even SIMD, just straightforward integer (and float) code.
SJC_Hacker
If its OpenGL why is it CPU only ?
brcmthrowaway
Now make it fixed point
mouse_
This will be perfect for Nintendo 3DS!
nnevatie
*OpenGL-style.
Pannoniae
Congrats for only reading the header ;) It's actually a pretty decent OpenGL 1.1 software implementation, obviously not complete and spec-correct though. It's more like those MiniGL drivers back in the day, implementing just enough of the spec so the game can run ;)
In a similar way, this implements just enough so Raylib's OpenGL backend can run! It was done so you can use the library without external graphics dependencies if you really want to.
furyofantares
That's an extremely snarky reply given the post is just a direct link to the header.
Pannoniae
No, the doc-header of the header! Apologies if I wasn't clear. I just thought the GP zoomed in on the word "-style" in the first line without reading more (it's probably since it's not a full 1.1 implementation, just something which can do enough to shim a good chunk of 1.1 functions so the RL GL1.1 backend can run)
Raylib's author was very happy to announce that you can compile an entire raylib program with no dependencies other than, say, being a win32 app https://x.com/raysan5/status/1980322289527976202