Questions about SDL graphics and SDL possibilities


I want use some library for graphics and windowing. I think SDL looks good for me and I am learning it with lazyFoo tutorials. I am not interest in to games, maybe later, but my main interest is applications like VSTi or for my program experiments and SDL as GUI.
Now my questions:

  1. is SDL good for applications? It is possible? Because it is more present like for games. My main choice for SDL instead use some GUI library is custom look and full control (I know, I must write all gui myself when I use SDL).
  2. How complex is SDL graphics? I mean, what can I draw with SDL graphics - I see Draw rectangles, lines - but can I draw and fill some custom shape? Or it is better use some externa library for that?

Yes it’s certainly possible and it’s easier and more flexible than using some GUI library. No, you don’t have to write GUI yourself, use my simple GUI toolkit below, does all the basic things and you can easily change it to do what you want, also the things that you cannot imagine doing when using a large GUI library such as GTK or Qt. Yes it is ideal for VSTI, synthesizers, programs for simulations and research, system tools. It also provides enough graphics for that, you mostly need some more advanced library when you want the graphics to be very fast, which is likely not necessary for such applications.
kiss_sdl - Simple generic GUI widget toolkit for SDL2

Check out SDL2_gfx, a companion library that supports drawing shapes like curves, circles, ellipses, polygons etc.

actsl thanks, your library looks interesting.
rtrussell thanks.

If someone know another library which work good with SDL, you are welcom post it.

I like Nuklear GUI.

It is renderer agnostic and can be adapted to many graphics toolkits.
It comes with an SDL/OpenGL adaptor. SDL’s 2D API is a bit limited, so
there is no adaptor for the pure SDL 2D render.

So for a slightly more powerful 2D API with SDL, I like SDL_gpu which
is another SDL satellite library.

It provides an SDL-like friendly API, but is more powerful and gives
you access to shaders if you want it. I wrote an adaptor for Nuklear
to use SDL_gpu.

I gave a talk at a large conference recently in Tokyo. I ran a few
demos, including a particle designer tool I wrote. It uses
The demo is somewhere after the 29 minute mark.


The GUI library you use depends of course on your needs, you may want something more advanced, everything has its pros and cons. The GUI toolkits like nuklear are for OpenGL and not in SDL2, how to explain it or what means in SDL2, if you want something similar to Lazy Foo SDL2 tutorials, and want your GUI to be written in that way, so that you can modify everything yourself, not knowing more about SDL than the Lazy Foo tutorials, then kiss_sdl is likely good for you.

What concerns the GUI toolkits for OpenGL, the most popular is dear imgui , this is the famous revolutionary immediate GUI, but this is in C++. I said, kiss_sdl goes in a way further in the concept from immediate GUI, what i call principal GUI, though i by far cannot compete in popularity.

The next such toolkit is nuklear. It is also very popular, but it is not small, it has 34692 lines of code, kiss_sdl has 2437 lines of code and it’s still generic, but more importantly, all its code is in a single header. Which is not so good idea, as this does not abstract away layers such as general functions, external library functions, drawing functions and widget functions, making changing the code and using different external libraries more difficult. Not a good way to write a code the way i think, but opinions may vary.

But again, the libraries you choose depends on your needs, everything has its pros and cons. SDL is great though, in that it offers quite a lot of choice in what libraries to use and how to do things.
kiss_sdl - Simple generic GUI widget toolkit for SDL2