user1566599
user1566599

Reputation: 11

programming vertical retrace in win7

Hi recently I was programming a synchronization part which strictly requires waiting for vertical retrace. So I used a Privileged instruction to do this: _inp(0x3DA) & 0x08. However, this instruction is privileged, and requires an installation of port95NT.exe to work properly on my old XP computer. When now it comes to Win7, run time warning occur to prevent me from execution, and neither can I install port95NT.exe on a 64 bit system. So anyone has other idea to detect the start of a new frame in vertical retrace on 64 bit Win7?

Upvotes: 1

Views: 516

Answers (2)

TwangGuru
TwangGuru

Reputation: 11

First of all, modern flatpanels DO work that way. Each pixel must be refreshed at regular intervals. There is a row/column strobe and a vertical refresh rate. Although there is no actually "blanking" as there was with CRTS, there is a vertical retrace where row/column values are returned to origin. For double (or triple) buffering systems, buffers must be swapped during this interval to avoid tearing of the frame. In addition, all professional video application must be frame synchronized to provide smooth frame switching, or for "gunlock" with cameras and other studio gear.

Upvotes: 1

bta
bta

Reputation: 45057

Microsoft designed APIs like DirectX so that developers didn't have to mess with hardware-level operations like this. Modern Windows versions may no longer have any way to access that hardware port directly.

You can try WaitForVerticalBlank() from the DirectDraw API, if you have that toolkit available. If you're using Direct3D, you can try D3DPRESENT_INTERVAL_ONE with Present() to force updates to wait until just after the vertical sync.

Upvotes: 3

Related Questions