[Interest] Z-sorting and explicit hiding of QSGNodes

Thomas Sevaldrud thomas at silentwings.no
Fri Feb 6 16:22:55 CET 2015


Hi,

I have two questions regarding QSGNodes. In my application I have used a
Repeater with delegate Items to place labels defined in QML on objects in a
3D scene. To achieve this, I made a class derived from QSGSimpleRectNode
and QObject with a slot that is called on the containing QWindow's
beforeRendering(). This slot method calculates the 2D screen position of
the 3D object in question and updates the parent QSGTransformNode
accordingly.

This works quite nice, except that I get my labels in a more or less random
depth order. I suspect that they are rendered in the order they are created
or inserted into the scene graph.

Is there a way to get z-order sorting of QSGGNodes?

For each label there is also a QuickItem which I could set the z value on,
but this item is generally not updated for each rendering frame, only when
the label content is changed. The label scenegraph node is updated for each
rendering frame, since the 3D camera is continously moving.

Also, many of these labels will be invisible much of the time, because the
end up outside of the 3D scene. Is there a way to say that an SGNode is
invisible, and thus avoiding that it is rendered, or do I need to update
the corresponding QuickItem again?

If the only solution to these two issues is to update the corresponding
QuickItem, what is the recommended way of doing this? I need to do this
when the GUI and rendering threads are synchronized

TIA for any ideas :-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150206/54e7af49/attachment.html>


More information about the Interest mailing list