QQuickWidget for a Game-like application



  • We have a rather large game-like application that uses QOpenglWidget and does its own Event processing. What this means is that it calls QApplication::processEvents() on every frame. Because QOpenglWidget->update() is called before, during processEvents, the scene gets drawn. So the very basic layout is:

    while(running)
    {
         // do a bit of work
         for(Window w: windows()) w->update();
         QApplication::processEvents();
         // Do some more work
    }
    

    Now what we would like to achieve is to render QML content on top of that so we thought to replace the QOpenGLWidget with a QQuickView and render our opengl scene using the beforeRendering callback. This "works" but only somehow. The QQuickView in its implementation has a timer which delays the actual draw request by a fixed 5 miliseconds to facilitate batching.
    This as a result means that our scene only gets drawn only every second frame because the timer gets started during the first processEvents() and can only be triggered the frame after. This basically means, that we block rendering for 5ms which is not an option for such an application. Is there a way to get around this - basically making sure that the View gets drawn exactly once per Loop?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.