GUI Toolkit in OpenGL

2019-03-28 04:15发布

问题:

I'd like to develop an application (in C++) similar to Pure Data, but with a cool GUI and a better documentation... Yes, something like Max/MSP or Reaktor, but free and open!

In order to create an appealing, reactive and portable interface I was thinking of using OpenGL. In my mind there is something like Blender GUI.

Before starting to develop my custom GUI toolkit I googled around in order to understand if there exist something that I could use, and I found:

  • Juce: it seems quite supported, but I didn't understand if you can only embed OpenGL canvas in your interface or it is possible to render all the widgets using OpenGL.
  • nUI: it seems really cool and portable, but... Its forum is a desert, and it's really hard to find a tutorial!
  • ceGUI, FLTK, GLUI: so flat and gray ;-) and any aren't still maintained.

Do you know other toolkit? As you understand I'm looking for a portable library (in C++), fast and supported.

The other possibility is developing from scratch my custom toolkit using SDL or Freeglut, in this case which could be the best solution?

P.S.: Reading other threads about this topic I noticed that many devs suggest using Qt... Could Qt relies on OpenGL for rendering? Or it could only host OpenGL canvas? Anyway do you think is possible (with good performance) creating something like this in Qt:

  • Reaktor GUI example 1
  • Reaktor GUI example 2
  • Blender Compositing example

回答1:

There isn't really a good openGL toolkit, they tend to get invented for a particular app and then sort of abandoned.

Yes Qt works very well with openGL, there is an openGL QGlWidget with full hardware acceleration (and optional links to openCL). You can have as many QGLwidgets as you like in a Qt app - each with their own openGL commands inside them.

You can also mix Qt and openGL in the same QGlWidget (http://doc.qt.nokia.com/qq/qq26-openglcanvas.html)

Slightly off topic: You can also select Qt to use openGL for all it's rendering - this is still a bit experimental but means that 2d Qt can be much faster on some embedded platforms like phones.
edit: To clarify -the entire app are still normal Qt but drawn with openGL commands 'under the hood'



回答2:

I like Clutter and MX.

See http://www.clutter-project.org/ and https://github.com/clutter-project/mx



回答3:

Qt 5.7 and up offers QtQuick Controls 2.0 in QML, which are implemented in OpenGL.

http://doc.qt.io/qt-5/qtquickcontrols2-index.html

Their API is very stable and works on Android, iOS, macOS, Windows, GNU/Linux, etc.

Here is a small hello world in a great book about QML. https://qmlbook.github.io/en/ch02/index.html#hello-world

You write JavaScript in QML and the QMake build system turns it into C++ object code.

import QtQuick 2.5

Rectangle {
    width: 360
    height: 360
    Text {
        anchors.centerIn: parent
        text: "Hello World"
    }
    MouseArea {
        anchors.fill: parent
        onClicked: {
            Qt.quit();
        }
    }
}