3 ms·
There’s simple and there’s naive. SDL already walked this path. So did pygame. It turns out without shaders, and all their complexity, you basically can’t do
by wokwokwok 4y ago
There’s simple and there’s naive.
SDL already walked this path. So did pygame.
It turns out without shaders, and all their complexity, you basically can’t do anything useful at high resolutions.
/shrug
It’s too slow; compositing, transformations, all the things people want to do are very much harder to implement in software on top of a naive graphics stack.
Simple doesn’t mean naive; you can have a simple api that is excellent.
…but this is a naïve implementation, and it won’t work in any useful way at scale.
People complain about ballooning complexity, but they often forget that stuff (eg. specialised graphics hardware) wasnt invented by a bunch of idiots.
It was invented because the naive approach, that they used before was found to be in practice fundamentally limiting, inferior and failed to meet people’s expectations.
Of course, if you vastly lower your expectations, and target say, 320x240 at 8bit colour, you can happily have a naïve implementation that works just fine
(Don't believe me? Quote:
> Having this we can now draw complex polygons and would probably need a “flood fill” algorithm. Typically it is implemented using a queue of pixels to check and paint, but we can use recursion, as long as the filled area remains small enough to not overflow the stack
^ This is the very definition of a naive implementation, and https://github.com/zserge/fenster/blob/e71d493fa6d544243dd601425179d6f7c7394b0e/fenster.h#L51 https://github.com/zserge/fenster/blob/e71d493fa6d544243dd60... settings one pixel at a time, is too. Delightfully charming as it might be to write your own functions that set one pixel at a time, it's a joke, really, if you expect to do anything serious)
- stephc_int13 4y agoFor any graphic intensive application it would be obviously be necessary to use a GPU. But for quick hacking / porting old demos / writing emulators and also text based UI it can be fast enough. With the added benefit of small footprint, high compatibility and fast startup time. The Lite editor https://github.com/rxi/lite https://github.com/rxi/lite is using pure software rendering (on top of SDL) in a rather naïve fashion but it still renders full 32bit colors at full resolution at more than 60FPS on my computer, not the best solution but still surprisingly fast given the simplicity of the renderer. This is typically a case where simple/naïve can beat a juggernaut like Electron.
- wokwokwok 4y ago> is using pure software rendering (on top of SDL) in a rather naïve fashion https://github.com/rxi/lite/blob/master/src/rencache.c#L4 https://github.com/rxi/lite/blob/master/src/rencache.c#L4 I think you'll find that they found the naive approach was sufficiently poor, performance wise, that additional optimizations had to be applied on-top. > But for quick hacking / porting old demos / writing emulators and also text based UI it can be fast enough. /shrug If you want to use it, use it. It's 'good enough'... > if you vastly lower your expectations