The workaround that I found was to disable flipping in nvidia-settings but this shouldn't be a permanent fix because it potentially degrades OpenGL performance:
Option "NoFlip" "boolean"
Disable OpenGL flipping; see Chapter 17 for a description. Default: OpenGL
will swap by flipping when possible.
[...]
o Flipping: When OpenGL flipping is enabled, OpenGL can perform buffer
swaps by changing which buffer the DAC scans out rather than copying the
back buffer contents to the front buffer; this is generally a much higher
performance mechanism and allows tearless swapping during the vertical
retrace (when __GL_SYNC_TO_VBLANK is set). The conditions under which
OpenGL can flip are slightly complicated, but in general: on GeForce or
newer hardware, OpenGL can flip when a single full screen unobscured
OpenGL application is running, and __GL_SYNC_TO_VBLANK is enabled.
Additionally, OpenGL can flip on Quadro hardware even when an OpenGL
window is partially obscured or not full screen or __GL_SYNC_TO_VBLANK is
not enabled.
The workaround that I found was to disable flipping in nvidia-settings but this shouldn't be a permanent fix because it potentially degrades OpenGL performance:
Option "NoFlip" "boolean"
Disable OpenGL flipping; see Chapter 17 for a description. Default: OpenGL
will swap by flipping when possible.
[...]
o Flipping: When OpenGL flipping is enabled, OpenGL can perform buffer
swaps by changing which buffer the DAC scans out rather than copying the
back buffer contents to the front buffer; this is generally a much higher
performance mechanism and allows tearless swapping during the vertical
retrace (when __GL_SYNC_TO_VBLANK is set). The conditions under which
OpenGL can flip are slightly complicated, but in general: on GeForce or
newer hardware, OpenGL can flip when a single full screen unobscured
OpenGL application is running, and __GL_SYNC_TO_VBLANK is enabled.
Additionally, OpenGL can flip on Quadro hardware even when an OpenGL
window is partially obscured or not full screen or __GL_SYNC_TO_VBLANK is
not enabled.