SteveSpencer
Posts: 344
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

GUI - which graphics library/system to use

Tue Jan 09, 2018 3:23 pm

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.
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

User avatar
topguy
Posts: 5005
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: GUI - which graphics library/system to use

Tue Jan 09, 2018 4:35 pm

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.

tvjon
Posts: 632
Joined: Mon Jan 07, 2013 9:11 am

Re: GUI - which graphics library/system to use

Tue Jan 09, 2018 4:41 pm

"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

SteveSpencer
Posts: 344
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: GUI - which graphics library/system to use

Wed Jan 10, 2018 11:18 am

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.
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

User avatar
topguy
Posts: 5005
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: GUI - which graphics library/system to use

Wed Jan 10, 2018 12:56 pm

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.

ghans
Posts: 7819
Joined: Mon Dec 12, 2011 8:30 pm
Location: Germany

Re: GUI - which graphics library/system to use

Wed Jan 10, 2018 3:47 pm

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
• Don't like the board ? Missing features ? Change to the prosilver theme ! You can find it in your settings.
• Don't like to search the forum BEFORE posting 'cos it's useless ? Try googling : yoursearchtermshere site:raspberrypi.org

paulslocum
Posts: 70
Joined: Sun Apr 09, 2017 10:54 pm

Re: GUI - which graphics library/system to use

Thu Jan 11, 2018 3:25 am

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).

raysan5
Posts: 37
Joined: Tue Sep 30, 2014 4:44 pm
Location: Barcelona
Contact: Website

Re: GUI - which graphics library/system to use

Mon Feb 19, 2018 9:57 am

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.

jars121
Posts: 123
Joined: Tue Jun 25, 2013 8:35 pm

Re: GUI - which graphics library/system to use

Thu Feb 22, 2018 9:49 pm

I've built quite an involved GUI application in Qt5, cross-compiled for the RPi2. Hardware acceleration works flawlessly when using QML and EGLFS.

Return to “Graphics programming”