Qt Threaded Renderer



  • Hi

    I have a 3D engine that run entierely in one thread. I can't separate inputs from renderer.
    I subclassed QQuickItem so my entiere engine can render with QML's OpenGL context.
    Everything works fine on Windows because there is no threaded renderer.
    But there is on MacOSX. So it crashes everytime QML wants to call my engine because my engine run entierely on the renderer thread.

    Is there a way to deactivate threaded renderer?
    If not, what is the Qt solution to be interoperable with non threaded opengl engines?



  • You can set the environment variable
    QML_BAD_GUI_RENDER_LOOP=1 on mac to force the non threaded renderer.



  • It works great, thx. Even on Android.
    Is it a fix officialy supported by Qt and will it continue to be in the future?



  • The right way to integrate with the scene graph when you cannot run on the rendering thread is to render to an FBO using a QOpenGLContext which has context sharing with the scene graph's opengl context. The resulting FBO can then be rendered as a texture in the scene graph.

    The examples/quick/scenegraph/textureinthread example illustrates how this can be done.

    As the name "QML_BAD_GUI_RENDER_LOOP" is not all that friendly, the environment variable is "QSG_RENDER_LOOP=basic" or "QSG_RENDER_LOOP=windows" starting with 5.1. Both "basic" and "windows" are doing rendering on the GUI thread. This flag is meant to be used as a debugging measure mostly, it is not properly supported API, but chances that it will go away is very small :)


Log in to reply
 

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