QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined



  • Hello,

    I want to use Qt5 with OpenGL. I saw the talk from Sean Harmer on youtube.

    Someone was able to recreate the code from the talk.
    https://github.com/advancingu/Qt5OpenGL

    But if I try to execute it I get the following error message " QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined ", and a transparent window appears.

    The code that is causing this error is probably:

    @void Window::paintGl()
    {
    mContext->makeCurrent(this);
    mScene->render();
    mContext->swapBuffers(this);
    }@

    Any idea why I get this error?

    The main problem is that the window is transparent. My guess is that this problem is related to the error message.



  • Where in code you said that you are using DoubleBuffer? SwapBuffer Only works when you use doubleBuffer.



  • The problem is, if the window is shown in the application but it is not in the window management system, it is a non exposed window. You cant swap the buffer on it.

    You have to do the first draw after exposeEvent occurs or check if( !isExposed ) on window before you draw.


Log in to reply
 

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