4 ms·
> There are plenty of 2D graphics APIs already from SDL SDL2 doesn't have a 2D graphics API in the traditional sense. It has a basic bitmap software blitter de
by Jasper_ 8y ago
> There are plenty of 2D graphics APIs already from SDL
SDL2 doesn't have a 2D graphics API in the traditional sense. It has a basic bitmap software blitter designed for debugging and bootstrapping. SDL2's main forte is just a being a cross-platform wrapper around the HW-accelerated APIs like OpenGL and Direct3D.
> to one in QT, GTK, Cairo
While Qt does indeed have QPainter, it is switching away from QPainter towards OpenGL with QtQuick. GTK+ uses Cairo (with plans to switch to OpenGL/Vulkan as well). So so far, our list is down from 4 to 2.
> and then the more proprietary ones
I'd list it as: GDI+ (Microsoft), Quartz 2D / CoreImage (Apple), Skia (Google) and Cairo (X.org). HTML5's <canvas> API is taken from Quartz but is often backed by the others.
So there are not that many choices for a modern 2D vector graphics library. My main issue with the 2D proposal is that hardware acceleration and modern graphics just flat out doesn't work the way the 2D API expects it to. You can be very good at pretending, but at some point you'll have to grow up, put on your big boy clothes, and use learn how GPUs work. Hence why there's the heavy migration away from the others. Direct2D has a good example here of a good API, even if the implementation is a bit wacky. Pathfinder 2 is similar.
- backpropaganda 8y ago> SDL2 doesn't have a 2D graphics API in the traditional sense. It has a basic bitmap software blitter designed for debugging and bootstrapping. This is actually incorrect. The SDL Render API does use GPU acceleration.
- alxmdev 8y agoIndeed it does, and you can use it to draw accelerated scaled and rotated images, lines, and rectangles. There are even a few blending modes available. It's a nice foundation for simple cross-platform 2D graphics, it's come a long way since SDL1.
- seba_dos1 8y agoThere's also old SDL's rival, Allegro 5, which also provides nice GPU accelerated graphics API.
- DLudwig 8y agoSDL2's render API can use GPU acceleration, however its feature set is rather limited. This is plenty for many, however is incomplete for others. I've heard its feature set be referred to as 'SNES-level graphics', or something to that effect, from at least one SDL-internals dev, something which I'd also echo.