[Interest] Scheduling updates for QQuickFramebufferObject and Renderer lifetime

Preet prismatic.project at gmail.com
Tue Dec 3 00:44:08 CET 2013


Hi,

I'm trying to regularly schedule updates for a QQuickFramebufferObject
using QTimer (for rendering a frame at regular intervals). I want to
skip frames if the QQuickFramebufferObject::Renderer is busy rendering
a frame.

My timer (in QQuickFramebufferObject) triggers a slot to do this:

MyQQuickFramebufferObject::onScheduleFrame()
{
    if(!renderer->busy()) { this->update(); }
}

To check if the renderer is busy I need to know if its been
instantiated... but given that QQuickFramebufferObject manages the
Renderer object lifetime, and that scenegraph nodes can be
created/destroyed dynamically, I'm not sure how to safely check
whether the Renderer exists:

MyQQuickFramebufferObject::onScheduleFrame()
{
    if(!rendererIsAlive) { return; } // how do I safely check this?
    if(!renderer->busy()) { this->update(); }
}

I can use a bit of a hack and call back to the QQuickFramebufferObject
from the Renderer on the Renderer's destructor, but for that to be
safe, the Renderer needs to be destroyed by the main thread, and not
the scenegraph renderer thread. So:

* Which thread destroys QQuickFramebufferObject::Renderer and is it
*always* the same thread?

* Is there a better way to render with frame skips?


Preet



More information about the Interest mailing list