[Interest] QtQuick over Qt3D (Qt 5.15)

Konstantin Shegunov kshegunov at gmail.com
Sat Apr 3 03:09:43 CEST 2021


On Thu, Apr 1, 2021 at 8:40 AM Paul Lemire <paul.lemire at kdab.com> wrote:

> Hello Paul,
>
Hello,

> It sounds to me like Scene2D is what you want as it renders a QtQuick
> scene into an offscreen texture which can then be applied to a Qt 3D mesh.
> Unfortunately it can only be used from QML.
>
> That being said, nothing is stopping you from having 90% of the Qt3D code
> in C++ and just having a small part in QML that essentially only
> instantiates your 3D Scene and the Scene2D and povides the 3D scene with
> the Scene2D texture. I think that would be the easiest.
>
Yes, that's what I've been using to "guide me through". And I do
acknowledge I can use it from QML, but there's also this thing:
https://bugreports.qt.io/browse/QTBUG-90411

> If you want to do it purely in C++, another approach (but more complex to
> set up and that would have to be tested) is to use a QSharedGLTexture to
> tell Qt3D about an existing OpenGL texture by textureId. This means using
> the Qt shared OpenGL context, and manually rolling your own
> QQuickRenderControl to render QtQuick into a QOpenGLTexture, and then
> providing the QOpenGLTexture's id to the QSharedGLTexture. You'll also need
> to ensure proper synching using fences (QWaitFence/QSetFence) to ensure
> that Qt3D is not trying to render while the the shared texture is being
> updated. This would be more or less similar to one of the manual test we
> have in Qt3D
> https://code.qt.io/cgit/qt/qt3d.git/tree/tests/manual/sharedtexture?h=5.15.2
>
> I hope that helps,
>
Indeed, thanks! Still, it doesn't seem there's a way I can hook into the
frame graph and just have anything drawn directly on the screen, is there?
The best I could do, as far as I can tell, is to have an ortographic camera
looking at a quad, which I can texture with whatever comes from the QtQuick
scene, it appears (i.e. what Florian Blume's code does here:
https://github.com/florianblume/Qt3D-BackgroundImage). Is this correct?

On Thu, Apr 1, 2021 at 11:15 AM Oleg Evseev <ev.mipt at gmail.com> wrote:

> By the way in Qt 5.14 there comes an option to use Scene3D as underlay
> without FBO:
>
> https://doc.qt.io/qt-5/qml-qtquick-scene3d-scene3d.html#compositingMode-prop
>
> I did tried this, but encountered with a problem when using together with
> OnDemand:
> https://bugreports.qt.io/browse/QTBUG-82861
>

Indeed. It does seem bugs reports've accumulated for Qt3D over time. View3D
also segfaults (the example) for some reason.

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


More information about the Interest mailing list