[Interest] QQuickWindow::update to render custom OpenGL in QtQuick2
Gunnar.Sletta at digia.com
Mon Jun 17 08:42:58 CEST 2013
On Jun 17, 2013, at 2:38 AM, Preet <prismatic.project at gmail.com> wrote:
> I want to render things with OpenGL directly in a QQuickItem (like http://doc-snapshot.qt-project.org/qt5-dev/qtquick/scenegraph-openglunderqml.html shows) but I get the impression that doing so means every other item in the scene is updated at the rate that I choose to call QQuickWindow::update() from my custom QQuickItem.
> I want to avoid the overhead of painting everything again and again if the items in the scene haven't changed, especially if I'm updating my object at 30 or even 60fps.
> With a QQuickItem that uses a QSGNode I can set DirtyStateBits and then call QQuickItem::update() to force an update to *just that* item. I can't do this with the tutorial I linked above though, because it's not using a node.
> * Does QQuickWindow::update() truly force a repaint to everything in the window even if it hasn't changed? If so...
Yes it does. Calling QQuickWindow::update() will re-schedule all drawing in the scene graph tree on the rendering thread. However, it does not sync with the GUI thread, so it is rather fast unless.
You can of course put your top-level item into a layer, by setting "layer.enabled: true" on the topmost QQuickItem. That will put the entire scene graph into a texture so the rendering so when you do QQuickWindow::update() there is only a single quad being drawn (unless the UI changes, of course).
> * Is there a way to use partial updates instead?
No, the default renderer does not do partial updates and I do not have plans to implement one that does.
> I'm aware I can render to an FBO, but that takes away the 'easy' full screen MSAA I get with the direct method.
> Interest mailing list
> Interest at qt-project.org
More information about the Interest