Am 20.06.22 um 10:08 schrieb Mike Krus:
Hi
On 20 Jun 2022, at 08:37, Yves Maurischat <yves.maurisc...@basyskom.com> wrote:
Hi all,
I've got a C++/QWidgets application with 2 Qt3DWindow embedded. The 3D windows
can be hidden (i.e. the user switches to another view), while work is done in
other parts of the application. Whenever the user switches back to the view
with the embedded Qt3DWindow there are a lot of changes to be made to the
scenegraph.
Rendering is set to OnDemand, but whenever the view is switched back to the 3D
windows there is a big lag, up to several seconds. Profiling the application
has shown that a lot of work is done for rendering at that point because the
scenegraph is changing (most time is spent in the material classes).
My working theory is, that each change to the scenegraph (i.e. removing
entities, adding a new ones) causes a separate render update, which leads to
the lag due to the amount of separate changes.
that is not correct, updates are batched on a per-frame basis. If you’re not
scheduling frames, no updates will be made.
If you are using Qt version 5.15.0 or later this should be pretty fast. Prior
version had a slower update mechanism.
I'm on Qt 5.14.2 for the application, but this is a reason to switch to
Qt 5.15.x
One thing to keep in mind though is that changing materials will lead shaders
needing to be recompiled, potentially textures to be updates, etc. Changing
geometry means bounding volumes need updating, buffers need to be uploaded, etc.
So the time might just be due to the GL state needing to be updated. You should
take care to minimise such changes.
I see. Currently large parts of the scenegraph are removed for an update
but I guess I could optimize changes so only the absolute necessary
parts are modified. Thanks!
Another thing to note, if you have 2 Qt3DWindows, then you have 2 underlying
Qt3DEngine instances. These do not share resources so everything might be done
twice.
Of course it’s impossible to provide accurate feedback without profiling the
actual code.
Mike
So my question is: Is there a way to disable all render updates until the scenegraph has
been updated/modified completely? What would be the "correct" way to make such
changes? Is there something similar to the beginResetModel() and endResetModel() methods
in QAbstractItemModel?
Thanks!
Yves
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
—
Mike Krus | mike.k...@kdab.com | Senior Software Engineer & Teamlead
KDAB (UK) Ltd., a KDAB Group company
Tel: UK Office +44 1625 809908 Mobile +44 7833 491941
KDAB - The Qt Experts, C++, OpenGL Experts
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest