Page 1 of 1

GUI - which graphics library/system to use

Posted: Tue Jan 09, 2018 3:23 pm
by SteveSpencer
I have a relatively straightforward (I hope) requirement.
First some background.

I have an MS Windows C++ app (source code too) that is basically a set of buttons and lists. Within Windows this is simply a collection of controls.
I have a variety of Pi, from Zero, original model B, all the way through to Pi3.
I also have a 10" HDMI screen with USB touchscreen interface.

I know the touchscreen works and is supported by the stock image for stretch - I have written this to a uSD card, booted a Pi3, and the normal desktop stuff works, including touch support.

I would like to rewrite my app to run on a Pi with said screen, ideally in C/C++. Ideally, it will run as a "kiosk" style app. For performance reasons, I don't want to run under a windowing environment, but effectively from the bash command line (or from a startup script).

Please don't suggest Pygame and python. I really DON'T want to learn a new language as well :(

What are my best options? From looking at the lower-level options, I would have to write my own buttons/listboxes etc.
Is there standalone graphics with controls/widgets support? Does SDL2, for instance, allow this?
Again, for performance reasons, I would like to use hardware acceleration if it's available - to give as smooth a response to the user as possible.

So, what are my options, and how much low-level stuff am I going to have to get my hands dirty with?

Any advice (with the exception stated above :)) welcomed.

Re: GUI - which graphics library/system to use

Posted: Tue Jan 09, 2018 4:35 pm
by topguy
or performance reasons, I don't want to run under a windowing environment, but effectively from the bash command line (or from a startup script).
How much performance are we talking about ? You can drop the fluff of a full desktop and still use X-windows in single application (kiosk) mode, that way you still have access to many common GUI-toolkits.
- https://www.wxwidgets.org/
- https://www.gtk.org/
- http://www.fltk.org/index.php

Qt5 is also an option of course.

Re: GUI - which graphics library/system to use

Posted: Tue Jan 09, 2018 4:41 pm
by tvjon
"I would like to use hardware acceleration if it's available...

For performance reasons, I don't want to run under a windowing environment, but effectively from the bash command line (or from a startup script)...

Please don't suggest Pygame and python. I really DON'T want to learn a new language as well... "

Look at:

https://github.com/ajstarks/openvg

Doesn't need X, hw accel' is supported. Graphics library, along with fonts, included.

You'll quickly be able to determine if its scope is adequate for your project.

HTH

Re: GUI - which graphics library/system to use

Posted: Wed Jan 10, 2018 11:18 am
by SteveSpencer
Thanks for both suggestions.
I probably want to run on a ZeroW, which fits nicely on the back of the screen. If I go down the "lite" route, the openvg stuff looks interesting. It doesn't have any widgets, but I have written controls for windows from scratch before, and that way I don't have any unwanted features :)

However, QT5 or X with widgets bears consideration/examination.
If I want h/w acceleration for X, does that mean using "experimental" drivers? I want this to be as stable as I can make it.

Re: GUI - which graphics library/system to use

Posted: Wed Jan 10, 2018 12:56 pm
by topguy
You can also compile Qt5 with GLES/EGLFS support to get hw accelleration without X or the experimental drivers. I think most standard Qt5 widgets would still work.

Re: GUI - which graphics library/system to use

Posted: Wed Jan 10, 2018 3:47 pm
by ghans
Qt5 should be quite smooth even on the old models. It completely ignores X and works directly with the old and stable OpenGLES 3D driver.

ghans

Re: GUI - which graphics library/system to use

Posted: Thu Jan 11, 2018 3:25 am
by paulslocum
I use SDL for everything, but would also consider OpenVG if portability wasn't required. Although in many cases, even you only know C++, it's still probably going to be quicker to hammer it out in Pygame. SDL is a lot more work -- you'll have to build SDL from source to run without X, and probably do a fair amount of work to get everything you need working. You'll probably need an SDL text handling/caching library and I never could get SDL_Image to display jpegs on the RPi (ended up using FreeImage instead).

Re: GUI - which graphics library/system to use

Posted: Mon Feb 19, 2018 9:57 am
by raysan5
You can consider using raylib and its imgui module raygui.

raylib runs on any PI version, using OpenGL ES 2.0 (native mode) or OpenGL 2.1 (desktop driver).

raygui is a single-file header-only add-on library over raylib, intended for simple tools. Usage examples:

rFXGen - simple sounds generator based on sfxr
Image


rGuiStyler - styling tool for raygui
Image


rTexViewer - image viewer and formats converter for gamedev (not published yet)
Image

raylib and raygui are designed to be high performant on the any PI device.

Re: GUI - which graphics library/system to use

Posted: Thu Feb 22, 2018 9:49 pm
by jars121
I've built quite an involved GUI application in Qt5, cross-compiled for the RPi2. Hardware acceleration works flawlessly when using QML and EGLFS.