[Interest] Few questions regarding Qt Quick Scene Graph

Artem Fedoskin afedoskin3 at gmail.com
Sun Apr 24 16:49:48 CEST 2016


I'm sorry. My first E-Mail was sent accidentally. Here is the final version
of my E-Mail.

Hello everybody. I have a project where a lot of objects are painted on the
screen whenever the user interacts with the app (pan, zoom, move) I would
be really grateful to you if you could answer a few questions regarding the
internals of Qt Quick Scene Graph:

   1. Imagine that I add 1000 nodes with the same color inside QQuickItem::
   updatePaintNode() function of some QQuickItem derived class. Will they
   be drawn in batch as described in http://doc.qt.io/qt-5/qtquick-
   visualcanvas-scenegraph-renderer.html#batching
   <http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph-renderer.html#batching>
   ?
   2. Can I call the function of some other class in QQuickItem::
   updatePaintNode()? I have some class named Data, class named View and a
   subclass of QSGGeometryNode Triangle. Imagine that after objects of
   these classes are created the Data asks View to create 10 Triangles. The
   View creates 10 Triangles during the updatePaintNode() call and passes
   to them pointers to the object of class Data, that required their
   instantiation. The Triangles refers to the Data and get some values from it
   and converts them to x,y coordinates. Is it something possible?

Do I violate the rule stated here http://doc.qt.io/qt-5/qtquick-visualcanvas
-scenegraph.html#scene-graph-and-rendering *"Warning:* It is crucial that
OpenGL operations and interaction with the scene graph happens exclusively
on the render thread, primarily during the updatePaintNode() call. The rule
of thumb is to only use classes with the "QSG" prefix inside the QQuickItem
::updatePaintNode <http://doc.qt.io/qt-5/qquickitem.html#updatePaintNode>()
function." ?

At first I was thinking about deriving classes like Triangle from QQuickItem
and then reparenting them to the View but the direct creation of
QSGGeometryNodes seems to me to be less memory requiring approach.

Regards,
Artem Fedoskin

2016-04-24 16:41 GMT+02:00 Artem Fedoskin <afedoskin3 at gmail.com>:

> Hello everybody. I have a project where a lot of objects are painted on
> the screen whenever the user interacts with the app (pan, zoom, move) I
> would be really grateful to you if you could answer a few questions
> regarding the internals of Qt Quick Scene Graph:
>
>    1. Imagine that I add 1000 nodes with the same color inside
>    QQuickItem::updatePaintNode() function of some QQuickItem derived class.
>    Will they be drawn in batch as described in
>    http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph-renderer.html#batching
>    <http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph-renderer.html#batching>
>    ?
>    2. Can I call the function of some other class in
>    QQuickItem::updatePaintNode()? I have some class named Data, class named
>    View and a subclass of QSGGeometryNode Triangle. Imagine that after objects
>    of these classes are created the Data asks View to create 10 Triangles. The
>    View creates 10 Triangles during the updatePaintNode() call and passes
>    pointers to the object of class Data, that required their instantiation.
>    The Triangles refers to the Data and get coordinates from it. Is it
>    something possible. Do I violate the rule stated here *"Warning:* It
>    is crucial that OpenGL operations and interaction with the scene graph
>    happens exclusively on the render thread, primarily during the
>    updatePaintNode() call. The rule of thumb is to only use classes with the
>    "QSG" prefix inside the QQuickItem::updatePaintNode
>    <http://doc.qt.io/qt-5/qquickitem.html#updatePaintNode>() function."
>    3.
>    4.
>    5.
>    6. For example, I want to get new coordinates of the object and to do
>    that I should refer to function of some other not QSGNode derived object
>    and then use these coordinates for rendering one of the nodes.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20160424/b62e1a4f/attachment.html>


More information about the Interest mailing list