• Advertisement
Sign in to follow this  

Detecting Vsync...

This topic is 3584 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I need to be able to detect when the card is in vertical sync. I am working under windows and using DirectX. I know that you can set that the swap effect is locked to vertical sync. But I need to actually detect when vertical sync actually happens. The reason for this is that I am developing an arcade game and I need to flash the screen white when a gun trigger is pressed. This needs to happen on a vertical sync. Thanks for anyones help.

Share this post


Link to post
Share on other sites
Advertisement
Why not just toss up a white quad over the screen whenever the user pulls the trigger? Or just clear the screen white and don't render for a frame.

Share this post


Link to post
Share on other sites
The reason is that a light gun is hooked to the monitor via a USB. And the device can only work and return valid data when vsync is active. So the screen needs to be flashed on a vsync

Share this post


Link to post
Share on other sites
Are you sure that's what you mean? By definition, the vertical blanking interval is the period of time when nothing is being drawn to the screen. The whole point of vsync is that you can update video RAM without affecting the visible image.

Share this post


Link to post
Share on other sites
"flashing the screen on vsync" is meaningless. The screen can never flash all at once. A particular pixel location will "flash" when the electron gun energizes it. This will happen at different times for different pixel locations. You just paint the screen white for one frame, and detect when that time is, to determine the location. (Apologies if you already knew all this).

In any case, as far as I know there's no way of getting this information from DirectX. Frames are buffered, so it would be difficult to even know which vsync preceded the white frame. The only thing I can think of is to monitor the vsync pin on the RGB connection. It should be relatively simple to connect this to the parallel port and monitor that, but it will require some amount of electronics knowledge. (You'll need that for the gun anyway, though.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement