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.

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.

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


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to