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
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.
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.
I think there's still value in learning the C++ language and making a game or a demo is quite rewarding although raylib does have bindings for basically every conceivable language.
What's cool about this is that computers are so fast that you could probably make a decent 2D game using only this software-rendered OpenGL 1.1 library.
Edit: I missed this was software rendered. I’m one gen-iteration ahead. Prob would still be possible to render my game cpu side provided I use the most efficient sprite depth ordering algorithm possible (my game is isometric pixel art like rollercoaster tycoon)
Ha! That’s what I’m stuck with for Metropolis 1998. I have to use the ancient OpenGL fixed function pipeline (thankfully I discovered an AB extension function in the gl.h file that allows addition fields to be passed to the GPU).
I’m using SFML for the graphics framework which I think is OpenGL 1.x
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.
OpenGL is an API. Software renderers for it—like the one that originally came with Windows NT, or even early versions of Mesa—have been out for a long time.
I haven't messed with it for a while, but last I checked it really wasn't that much code to make it run on the GPU. Maybe an extra 100 lines or so. Although you couldn't use windowed mode, had to be fullscreen.
This is an implementation of the OpenGL API interface. It is not OpenGL. It does not support GPU acceleration. It does math with floating point on the CPU. It then draws points and lines on a 2D surface provided by raylib.
Could this be adapted to use SIMD, or a GPU? Sure. That is not what this is today.
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.
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)
Still, if you post a link to a roughly 5k line raw source file, rather than like, some post about it, roughly nobody is gonna read much of the file before commenting.
Curious to hear the take Tsoding has on that news.
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
but ... why?
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.
Why not? The original Doom didn't use a GPU renderer. It should be possible to do simple 3d stuff in today's computers without it.
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.
If you want to do that, skip C++ entirely and just use Javascript or Python. You can get shiny things really quickly.
I think there's still value in learning the C++ language and making a game or a demo is quite rewarding although raylib does have bindings for basically every conceivable language.
I mean this with all the appropriate venom we can muster: this attitude is why software quality is nonexistent.
What's cool about this is that computers are so fast that you could probably make a decent 2D game using only this software-rendered OpenGL 1.1 library.
Edit: I missed this was software rendered. I’m one gen-iteration ahead. Prob would still be possible to render my game cpu side provided I use the most efficient sprite depth ordering algorithm possible (my game is isometric pixel art like rollercoaster tycoon)
Ha! That’s what I’m stuck with for Metropolis 1998. I have to use the ancient OpenGL fixed function pipeline (thankfully I discovered an AB extension function in the gl.h file that allows addition fields to be passed to the GPU).
I’m using SFML for the graphics framework which I think is OpenGL 1.x
Game to show what’s possible: https://store.steampowered.com/app/2287430/Metropolis_1998/
Fabrice Bellard also wrote an OpenGL thing: https://bellard.org/TinyGL/
What an aspirational figure, that guy does it all!
> OpenGL 1.1-style implementation on software
How many lines to implement OpenGL 2.0 (non ES) ?
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.
Not sure what the line count is, but PortableGL is a software renderer for 3.x(ish):
https://github.com/rswinkle/PortableGL
Cool project, and fun to play with.
Does this support CUDA?
No, this is CPU rendering only! Not even SIMD, just straightforward integer (and float) code.
It would be kind of neat to have OpenGL running on AVX-512, just for fun…
If its OpenGL why is it CPU only ?
OpenGL is an API. Software renderers for it—like the one that originally came with Windows NT, or even early versions of Mesa—have been out for a long time.
I haven't messed with it for a while, but last I checked it really wasn't that much code to make it run on the GPU. Maybe an extra 100 lines or so. Although you couldn't use windowed mode, had to be fullscreen.
Haven’t messed with what?
This is an implementation of the OpenGL API interface. It is not OpenGL. It does not support GPU acceleration. It does math with floating point on the CPU. It then draws points and lines on a 2D surface provided by raylib.
Could this be adapted to use SIMD, or a GPU? Sure. That is not what this is today.
Now make it fixed point
Fixed point would be hell trying to keep track of the ranges. Maybe Posits or LNSs.
This will be perfect for Nintendo 3DS!
Interesting. Does this mean it could be used for creating games for NES, SNES, Genesis, etc?
*OpenGL-style.
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.
That's an extremely snarky reply given the post is just a direct link to the header.
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)
Still, if you post a link to a roughly 5k line raw source file, rather than like, some post about it, roughly nobody is gonna read much of the file before commenting.
edit: I stand corrected by the downmods!