Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLContext::swapBuffers() called with non-exposed window, behavior is undefined

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 15.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kantaki
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • 1 Offline
      1 Offline
      1313
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kane
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved