Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to close OpenGL Window opened using OpenGLUnderQML? [Solved]



  • I'm developing an app that has an augmented reality (AR) window that is invoked from a main window showing map data. Using "afterRendering" as described in the OpenGLUnderQML example, I am successfully rendering OpenGL images over the camera viewfinder image. When I exit the AR window the OpenGL thread keeps on rendering, over the map or any other screen I bring up. If I go back to the AR window a second time... a second OpenGL thread is opened, indeed you can create new threads over and over.

    Any suggestions on how to truly close/kill the OpenGLUnderQML thread upon exiting the AR window?

    I'm new to both OpenGL and Qt, hopefully I've just overlooked an obvious solution.

    Basics: Qt 5.4 on Mac, iOS and Android target.



  • The solution that worked for me is to keep the OpenGL window open all the time, and pass a flag from the QML code to indicate whether it should draw or not.