Important: Please read the Qt Code of Conduct -

Crash in swapBuffer with two QWindows

  • Hi I am creating an Qt5 application, having two QWindows with their own QOpenGLContext.
    Window1 is a parent of Window2. Window1 displays an image using a texture, and Window2 displays an overlay with lines, circles using OpenGL. The program works fine until I try to re-render Window1. It crashes on m_context->swapBuffer(), where m_context is the Window1's QOpenGLContext. If I do not re-render Window1 I can re-render , i.e. update Window2 without any problem.
    I am using as a base class for both windows the OpenGLWindow from the openglwindow example.
    Any idea why this happens?
    Will appreciate any design advice. I pretty new to Qt/OpenGL.

  • I fixed the problem.
    m_context->makeCurrent(this) shall be called religiously before and after swapBuffers() !

Log in to reply