How to enforce vertical synchronisation with the new Qt5 OpenGL API
-
Typical OpenGL applications can enforce vsync (sync to video blank / vblank) to avoid screen tearing, using some window server specific extensions. The "swap_control" extensions does the trick, providing some platform specific function calls: glxSwapIntervalEXT on Linux X11 or wglSwapIntervalEXT on Windows, as stated by "OpenGL Official Wiki":http://www.opengl.org/wiki/Swap_Interval
Qt5 offers an new method to acquire an OpenGL context. This method is well described by the "OpenGL Window example":http://qt-project.org/doc/qt-5.0/qtgui/openglwindow.html . However, using the new API of Qt GUI, it doesn't seem possible to enforce vsync using a swapInterval(1) call. The example suggests that the user must set the option in their video card driver configurations. Although, this is not acceptable for me.
How should we enforce vsync with the new Qt5 QtGui OpenGL flavor?
Thank you,
-
Indeed this looks to be missing. Please file a feature request at bugreports.qt-project.org.
As a work around you will need to call the appropriate wgl/glx function yourself I'm afraid.