[Interest] [Qt3D] Best way to do operations before rendering

Xavier Bigand flamaros.xavier at gmail.com
Mon Oct 3 11:07:04 CEST 2016


Hi,

I think that I didn't explain correctly how I use the uber shader, it's a
shader that will change with properties of the material. Our shader is
rebuild when lighting, engine settings,... changed so it might be rebuild
at anytime for already existing objects. To avoid to regenerate the shader
to much i am using dirty flag, but by doing that I need a slot called at
each frame to check it.

I'll certainly will have some other operations to do at each frame, like
lights sorting for shadows,...
I have a class responsible of the root node, that will be responsible to
manage those operations, this will allow us to have only one
synchronization point.

Maybe that it is simplier to use the QQuickWindow::beforeRendering?


2016-10-03 9:21 GMT+02:00 Sean Harmer <sean.harmer at kdab.com>:

> Hi,
>
> a QFrameAction is for code that should be executed once per frame not a
> one time thing. It's mainly useful for prototyping as it can be quite
> expensive due the backend/frontend synchronisation it entails.
>
> To have some operation completed before rendering a part of your scene
> graph, just defer adding that subtree to the scene graph until it is done.
> That is, call your function that builds your uber shader then when that is
> done add your sub-tree that uses that shader to the main scene graph.
>
> Cheers,
>
> Sean
>
>
> On 02/10/2016 22:22, Xavier Bigand wrote:
>
>> I have some operations that I need to do before the scene-graph start
>> the rendering or a least be able to do an operation before a specific
>> node is rendered.
>>
>> I want to start by building the source code of the uber-shader used by
>> my custom material. So I tried to use a QFrameAction on my root scene
>> node, but the slot isn't called.
>> I have attached the QFrameAction as component of root node and then
>> connect my slot to it, but the slot is never called.
>>
>> My I missed something, or it is simply not the good way to do?
>>
>>
>> --
>> Xavier
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
> --
> Dr Sean Harmer | sean.harmer at kdab.com | Managing Director UK
> KDAB (UK) Ltd, a KDAB Group company
> Tel. +44 (0)1625 809908; Sweden (HQ) +46-563-540090
> Mobile: +44 (0)7545 140604
> KDAB - Qt Experts
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>



-- 
Xavier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161003/bbc539df/attachment.html>


More information about the Interest mailing list