Use glFlush() if swapBehavior is single-buffered
authorJan-Arve Saether <jan-arve.saether@nokia.com>
Mon, 30 Jul 2012 12:21:15 +0000 (14:21 +0200)
committerQt by Nokia <qt-info@nokia.com>
Thu, 2 Aug 2012 18:41:18 +0000 (20:41 +0200)
Otherwise, use swapBuffers()

This fixes an issue where swapbuffers() did not swap the
"back buffer" to the "front buffer" if we had single-buffered swap
behavior.
This was an issue on Windows 7 with an NVIDIA graphics card that
by default was using single-buffered mode.

Change-Id: If53f54146e4633305be3ad5158565752b6516b59
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
src/gui/kernel/qopenglcontext.cpp

index ffb0726..d476278 100644 (file)
@@ -567,7 +567,8 @@ void QOpenGLContext::swapBuffers(QSurface *surface)
     if (framebufferBinding != platformFramebuffer)
         qWarning() << "QOpenGLContext::swapBuffers() called with non-default framebuffer object bound";
 #endif
-
+    if (surface->format().swapBehavior() == QSurfaceFormat::SingleBuffer)
+        glFlush();
     d->platformGLContext->swapBuffers(surfaceHandle);
 }