[Interest] QtQuick over Qt3D (Qt 5.15)

Konstantin Shegunov kshegunov at gmail.com
Mon Mar 29 12:28:34 CEST 2021


Hello,
I want to overlay a QtQuick UI over a Qt3D scene I'm having, however (here
comes the "but") I want to do it from C++. I don't want to get into
instantiating Scene3D at all, I want to drive the Quick scene from Qt3D,
not vice versa (i.e. I don't want to render the 3D content to an FBO, and I
don't intend to depend on the QML engine to setup the Qt3D parts).
Sound(ed) like a simple-enough task at first, but I'm having the worst time
figuring it out.

To start, I've set the Qt3D things up and I can show my mesh. For the
second part, I read a lot of the sources around Scene3D, Scene2D and Qt3D
examples but it doesn't appear this "obvious" thing to do is covered
anywhere, notwithstanding half the Qt3D examples being broken (either
segfaulting or not building at all).

I was initially intending to get some ideas from Scene3D, but it appears it
works directly with the private classes for one, and for two it forces
synchronous rendering that's driven from the quick scene ... and as a
typical QtQuick item it doesn't expose a public C++ class ...
If I missed something there, please feel welcome to correct me.

So after the next batch of sifting through Qt3D's own internals, the
renderer plugin and such, I am relatively convinced the only reasonable way
to do this is to render the UI offscreen to a texture and to just slap that
texture on the screen on each Qt3D frame. Is this correct? If that's so,
let's say I can render the quick scene to a texture, how do I go about
putting it on the screen after the framegraph's been executed? I couldn't
see a framegraph node that'd do that for me. Am I to write my own? Is it
the case that I need to create a "fake" quad (i.e. a billboard) that I must
reorient together with the camera? I saw in one of Florian Blume's
repositories that he uses a second camera and another branch in the
framegraph to put a background image in. Is this the way to do it, or is
there some better way?

Additional question(s):
Do I spin my thread (which I sync manually) for rendering the quick scene?

Thanks for any and all pointers.

Kind regards,
Konstantin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20210329/389a0af5/attachment.html>


More information about the Interest mailing list