Re: QML on top of QT3D View
>thanks for your answer. In fact I have I have no qt3D qml I have a full opengl Qt3D C++ application and It wants
to add as overlay when needs (for the setup only) a qml interface.
>
>- I don't understand why there is overhead when switching from 2D drawing to 3D : If I have an opengl view to
render qml, I was thinking there was no overhead to switch from 2D to 3D, just rendering the 2D qml in an fbo
then just draw the texture ?
Switching to an fbo for rendering has an overhead, and the GL state in the QGLContext needs to be switched
from the requirements for 3D to 2D and back again. That's a lot of state changes. Have a look at the
beginNativePainting() function in the GL2 paint engine for an example of what happens during the switch.
>- for me the approach you propose seems at the reverse of logic : The main application is the 3D View with C++
opengl, and I need to have a QDeclarativeView as main container for all the application, and I need to embed
the 3D in the Declarative View : it's not possible to do the reverse, so when I hide the QML interface I have no
overhead at all ?
The main application shell (menus, toolbars, whatever) can be in C++, with a QDeclarativeView embedded
where you want the QML and 3D elements to appear. I suppose you could switch out the QDeclarativeView with a
regular QGLView/QGLWidget when you hide the QML interface. But the resultant screen flashing to repaint
that area when the widget is switched probably won't be very good.
Rendering QML into an fbo isn't impossible - we ourselves are working on it for putting QML/2D scenes on the
side of QML/3D objects. I don't have a firm ETA for when that will happen. But it isn't just an issue of
drawing into an fbo. You also need to arrange for mouse and keyboard events to be delivered properly to the
embedded scene so that the QML controls will work. This is not trivial, which is partly why it is taking us so
long in QML/3D. There is a huge legacy of inflexible design in QGraphicsView to work around. It really only
works if you go "all QML" or "all C++" at the moment. Sorry.
Cheers,
Rhys.