Update swap interval of QCocoaGLContext after creation

QSurfaceFormat is recreated from scratch, and by not reading back the
swap interval the QCocoaGLContext seemed to be vsynced even if it
actually was not.

Change-Id: I72ddaae9a4c695fe4c74d7b4b70ca9db84bcc084
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Tor Arne Vestbø 2016-08-31 19:42:31 +02:00 committed by Tor Arne Vestbø
parent 6ce96fdbf5
commit 44fec65624

View File

@ -323,6 +323,11 @@ void QCocoaGLContext::updateSurfaceFormat()
[pixelFormat release]; [pixelFormat release];
GLint swapInterval = -1;
[m_context getValues:&swapInterval forParameter:NSOpenGLCPSwapInterval];
if (swapInterval >= 0)
m_format.setSwapInterval(swapInterval);
// Restore the original context // Restore the original context
CGLSetCurrentContext(oldContext); CGLSetCurrentContext(oldContext);
} }