Embedding OpenGL graphics drawn through the OpenGL C++ API with a QML GUI
-
I would like to embed my "custom" graphics generated through the OpenGL C++ API with a QML-defined GUI. The “underlay” approach described by Guiseppe D’Angelo looks to do almost exactly what I want. But that approach relies on subclassing QQuickView, and my QML GUI needs to contain a menu bar, which apparently isn’t supported by QQuickView. Can D’Angelo’s approach somehow display a menu bar, or can someone recommend an alternate approach?
Thanks! -
See https://doc.qt.io/qt-5/qquickframebufferobject.html. You'll have to inherit this, register it with the application engine, and then add it to your window.
-
See https://doc.qt.io/qt-5/qquickframebufferobject.html. You'll have to inherit this, register it with the application engine, and then add it to your window.
@Jkimmy - thanks for that suggestion. Looking at that documentation and others I wonder if using a non-default frame buffer is over-kill for my application. This page from khronos.org says "Framebuffer objects are very complicated", and I want to keep my code as simple as possible, but no simpler (haha). My app does not require lots of high-performance animation (I want to display a three-dimensional object that the user can examine using the mouse to change the viewpoint). Is there a simpler approach? Thanks!
-
What about the new QtQuick3D? You don't even need to touch any c++ to get started. There is also https://doc.qt.io/qt-5/qtquick-scenegraph-openglunderqml-example.html if you depend on OpenGL.