[Interest] Questions regarding Scene Graph (QSGClipNode, QSGTexture, QSGOpacityNode)

Artem Fedoskin afedoskin3 at gmail.com
Mon May 9 22:54:11 CEST 2016


Thank you for your reply Gunnar.

I found a great class for drawing polygons in QML here http://gitlab.
unique-conception.org/qt-libraries/lib-qt-qml-tricks (QQuickPolygon) and
adopted triangulation methods of this class to my needs.
But as always, a bunch of questions arose :)

   1. Initially, I thought that Scene Graph reparents all visual children
   of the QQuickItem to the node that is returned from call UpdatePaintNode.
   However, when I tried set to return QSGClippingNode from the parent
   item's updatePaintNode, nodes of its children QQuickItems weren't
   reparented to the clipping node. I also noticed from debugger output
   that when I set QQuickItem's property "clip" to true, new QSGClippingNode
   is created implicitly, to which all nodes of child QQuickItems are
   reparented. How can I do something like native QML clipping but with my
   own clipping geometry?
   2. Is the node that is hided under the area outside clipping polygon
   rendered? I noticed that nodes with 0 opacity in debugger has "BLOCKED"
   state whereas hided by clipping nodes has the same state as visible.
   3. In which cases are nodes deleted? If I don't delete a main node of
   QQuickItem in cases when boundingRect is empty as I saw in examples from
   Qt can I be sure that throughout the whole run of my program the nodes
   won't be implicitly deleted by Scene Graph. Is it very important to delete
   nodes when boundingRect is empty?

Thank you very much for your help. You keep my project going :)

Regards, Artem

2016-05-09 11:31 GMT+02:00 Gunnar Sletta <gunnar at sletta.org>:

>
> > On 08 May 2016, at 01:22, Artem Fedoskin <afedoskin3 at gmail.com> wrote:
> >
> > 1. Could you tell me please how one can set custom geometry for
> QSGClipNode (not the rectangular one)? Should I just create QSGeometry with
> QSGGeometry::defaultAttributes_Point2D() attribute and add vertices? Will
> Scene Graph recognize that polygon is closed (I need clipping to have a
> form of circle)?
>
> You need to add triangles though, not a polygon outline. And when you add
> triangles, closing the polygon is no longer an issue :)
>
> > 2. If I want to maintain a cache for a bunch of QSGTextures and reuse
> them for changing texture of QSGSimpleTextureNode how should I delete them?
> Should I just explicitly delete them in destructor of QSGNode derived
> object in which I hold them?
>
> Yes, you need to manage them yourself and deleting them from a QSGNode is
> the most sensible place as QSGNodes will be cleaned up automatically.
>
> > 3. If I set opacity to 0 does this mean that node is not rendered? How
> is it different from just taking a node out of a node tree?
>
> The approaches should be pretty much the same thing internally.
>
> cheers,
> Gunnar
>
> >
> > Regards, Artem Fedoskin
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160509/1a717fc2/attachment.html>


More information about the Interest mailing list