Link to home
Start Free TrialLog in
Avatar of ttsenis
ttsenis

asked on

Info on VSYNC

Hi,
   in a window state game i can not use flip under DIRECTX. Instead i can use overlay flip. I do not want to use overalys because they are tricky. Instead i made a complex chain and the pointer off Primary surf is being scrolled over this complex surf. The main problem is that i can not detect the VSYNC so the animation does not have a normal-continous rate. Any ideas on detecting VSYNC.
Avatar of fl0yd
fl0yd

I'm not sure if you can retrieve a vsync through directx. The question is: Do you really need to know the exact time when a new frame is started? Shouldn't you make your rendering (i.e. animation, ...) time-based and use a high precision timer to control it. Use QueryPerformanceFrequency() and QueryPerformanceCounter() to get such a timer.

A side note: Unless you are targetting for a win nt system prior to 5.0 you shouldn't be using direct draw anymore. DX8 has introduced DirectX Graphics which is basically the old Direct3D interface.

.f
I've checked it and found out that DirectDraw provides the functionality you need. IDirectDraw2::GetVerticalBlankStatus( lpbIsInVB ) and IDirectDraw2::GetScanLine( lpdwScanLine ). Note that the latter can return ERR_NOT_SUPPORTED so you need a solution that can work without it if it's not available on a specific target machine.

.f
ASKER CERTIFIED SOLUTION
Avatar of fl0yd
fl0yd

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ttsenis

ASKER

I think that i will use GetTickCount syncronized through GetVerticalBlankStatus in order to get the maximum time for few calculations.