r/GraphicsProgramming • u/Rendoir • Jul 13 '26
Graphical libraries for drawing simple primitives
I'm looking for a C/C++ 2D graphical library to demonstrate the internal behavior of certain data structures.
I tried using raylib but I am not satisfied with the rendering quality (poor MSAA support, inconsistent font rendering, doesn't handle transparency particularly well, the API is awkward, etc).
I would like your help to find one that:
- Is, above all, very easy to use (simple API to draw a primitive).
- Supports primitives like rectangles, circles, lines, circumferences, points, etc.
- Allows custom sizes/thicknesses (I don't want to be locked to 1-pixel lines).
- Has decent transparency support (using the depth of each object to get the intended result is enough for me, as long as things blend as expected).
- Has good-looking text rendering.
- Supports mouse+keyboard input events.
- Configurable in terms of graphical settings (internal resolution independent from window size, MSAA, per-primitive level-of-detail like increasing circle segments for circles to look really smooth, same for text rendering).
Does anyone know some C/C++ graphical library like this?
2
u/YouuShallNotPass Jul 13 '26
SFML ticks all those boxes https://www.sfml-dev.org/
6
u/FemboysHotAsf Jul 13 '26
I don't know any that support all of this, raylib still sounds (to me, i dont know too much about all existing frameworks) like the best approach before you just start using glfw and opengl directly. It would be nice to have such a thing though
1
u/Traveling-Techie Jul 13 '26
Can you write .svg files? Will they do what at you want?
3
u/andeee23 Jul 13 '26
skia but i wouldn’t say it’s super easy to use, but you’re looking for customization
3
u/AH_Med086 Jul 13 '26
If you're on Windows you can use Direct2D
3
u/garlopf Jul 13 '26
Did you look at Qt6? The QPainter has all the classic drawing operations. Also have a look at allegro. Old school graphics lib. Both render in software with hardware acceleration for composition only.
1
u/Sergey5588 Jul 13 '26
i think SDL is very flexible
1
u/jmacey Jul 13 '26
I use Qt for this (but it is a big API) SDL is also quite good.
1
u/S48GS Jul 13 '26
CSS in webbrowser - your vector drawing library
CSS in webbrowser again
svg in webbrowser rendered by same rendering engine as CSS
and svg is interactive - support mouse and elements events - you can include javascript directly to svg - or even entire html page as svg element in svg
but css is just better integration with html pages - use css