Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QWindow OpenGL Tearing



  • I'm having a strange issue with a setup that uses a class inheriting QOffscreenSurface and one inheriting QWindow (QT 5.14.2 MSVC 2017 64 bit, Windows 10). The offscreen renderer creates an OpenGL texture and the window displays it.

    I see what seems to be a VSync-related tearing on the output window:
    normal.jpg glitch.jpg

    There is no pattern it seems to be on different parts of the screen and not at any specific times. It happens more often when the output resolution is higher. Turning VSync off using QSurfaceFormat::setSwapInterval(0) seems to be a work around which would mean that somehow something during the rendering process is interfering with the screen buffer swap.

    The code to reproduce this is here:
    https://github.com/rtavakko/Tearing

    Has anyone seen this happen and know what could be causing the problem? Any tips would be greatly appreciated.

    Cheers


  • Lifetime Qt Champion

    Hi,

    Your code is pretty big to go through.
    Would it be possible to reduce it ?



  • @SGaist Sure, I've removed some of the unused files and code. Let me know if I can simplify it more.



  • An update on this, it seems to happen only when there are two or more windows active which would again point to a sync-related issue? I'm also not sure if having multiple OpenGL contexts all sharing resources could be contributing. Theory says this should be ok.