multiple windows swap at the same time (vsync)

Hi all,

i have a question about swapping buffers in sync with vertical
retrace to avoid tearing.

Situation is: i have multiple opengl windows on the same
( virtual ) monitor. I do this because framebuffers are
limited in edge size ( 8k ) but my output resolution may exceed this in one direction.

If the first window swaps to vsync, the other one(s) will miss
this frame, since the swap happened when the function
returns. Result is a visible delay between the windows.
I tried calling the first with vsync turned on and the others
immediately after this without vsync turned on but this does
not work, tearing is visible.

Is there a possibility to call each windows swap in a non-
blocking way, eg. i can just ‘trigger’ the swapbuffer call without actually waiting for it?

I would prefer a solution without using different
threads or processes&ipc, just for performance and simplicity,
if there is any -

Best regards,

If you have a nVidia Quadro with framelock support, you can try the following extensions:

Extension 350 GLX_NV_swap_group on Linux:

or extension 351 WGL_NV_swap_group on Windows:

ATI FirePro professional graphics cards also support the WGL_NV_swap_group and GLX_NV_swap_group extensions if you have the S400 Framelock/Genlock card. See here. It even works across GPUs in different machines.



If ‘blocking’ is your main problem with swapbuffers() you should use separate contexts in separate threads. Each window would run in its own thread and should be able to sync correctly without blocking the other windows.

I haven’t done multiple window rendering myself, so please anybody correct me if I’m wrong!

… but it seems obvious enough to me.

My application is configured how def suggested: Four windows, each with a dedicated OpenGL context, and each managed/owned by a dedicated thread. With Vsync enabled, the threads’ timings appear correct (each thread will wait up to 16 and 2/3 ms), but there is still a visual tear across the windows, in different relative and absolute vertical positions. If I disable all but 1 window, vsync works. Apparently Nvidia’s driver detects multiple windows/threads and changes its behavior somehow, breaking vsync.

I have also tried using the G-sync 2 with the swap_groups extension. The short story is that it did not work, and only 2 of my 4 windows could join the group.

Has anyone with a similar use case been able to overcome the tearing issue? How about with non-Nvidia platforms?

Just wondering, you are talking about >8k “output resolution”, so we are not talking about any kind of monitoring output.
Why do you need vsync at all, its only there to avoid tearing on screen, you will never get tearing inside any framebuffers…


thank you all for your answers!
Yes, i want to display on monitors ( projectors ), so there is visible tearing. I heard about the context/thread solution, but i am sad to hear it does not work.

Yet another reason to look for the Equalizer Framework. Maybe they can handle this situation?