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/Qt5OpenGLBut 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.
-
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.