Vsync from secondary monitor

Hey all,

Does anyone have experience with synchronizing an OpenGL application to a secondary display’s vsync? I’m using wglSwapIntervalEXT(1), but from what I can tell that only ties into the primary monitor’s vsync.

My OpenGL program only runs in one display (the projector), so I could just swap primary/secondary displays from the Win7 resolution settings window. That’s what I’m doing now as a workaround, but it is really tedious and I’d like to get this working in code. Any ideas are welcome.

my setup:
NVIDIA Quadro 4000
Primary monitor: 1440x900 @ 60Hz
Secondary monitor: 1024x768 @ 60Hz

Thanks,
Fredric

Update on this after running some more tests this morning.

I spliced out the vsync wires from the VGA cables. I plugged the vsync wires into an oscilloscope, and confirmed that despite the fact that the vsyncs are set to 60Hz, one is actually slightly different than the other (~59Hz). That causes the two vsync signals to drift apart from each other, which causes the graphical glitches that I’m seeing.

At that point I tried playing around with different resolution settings in Windows 7 to see if I could keep the two vsyncs from drifting. I was able to keep them from drifting by setting the two monitor’s resolution to the same width and height (1024x768). This also fixed the graphical glitches in my OpenGL application. Unfortunately it doesn’t really help since I need both displays to have different resolutions, but I thought I’d mention this as a possible workaround in case someone else is having a similar problem.

I frequently see 59 and 60 Hz being suggested for HD resolutions on LCD screens, be sure to select 60Hz for both screens.

EDIT: rereading your post apparently it is already the case… Can you try 59Hz on both ?

I can only set 60Hz and 75Hz from each monitor’s advanced settings window. Is there a win32 function to set the monitor’s frequency that would let me specify 59Hz?

Some background info so that you know why I care so much about the vsync signal: I’m trying to use OpenGL to project a series of images on an object and then capture each frame with a gigabit ethernet camera. I’m then taking those images and reconstructing a 3D model of the object. This works fine if the projector is the only display attached to the computer, but it does not work with a dual monitor setup. The images come back with ghosts of other frames in them, which ultimately ruins the 3D model. From what I’ve been able to tell from debugging it looks like the program is hooking into the wrong vsync signal and there isn’t any way around that in Windows 7 without swapping the primary/secondary display each time.

I sort of solved this problem by flipping the monitors in code before and after running my application using the ChangeDisplaySettingsEx win32 method. That’s real rough, because all the icons and programs move to the other desktop, and sometimes they don’t move back to the right spot when the program ends.

I’ve read some articles that suggest that DirectX may be able to synchronize with the seconary monitor’s vsync. Maybe I should be using DirectX instead of OpenGL for this, although I’d really hate to have to rewrite everything. :frowning:

It took me a while to figure this out, but simply disabling the “aero” features in Windows 7 worked for me.
FWIW, I’m using an LCD (locked to 60hz) for coding, and a CRT (running at over 100hz) to display fullscreen graphics for visual psychophysics.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.