User Synchronization using WaitForVerticalBlank
Posted on 2006-06-13
I am using DirectX 9. I need to synchronize the time a bitmap displays and output of a TTL pulse with a National Instruments Digital Input/Output board. The only method available seems to be:
IDirectDraw::WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent);
I have found no tutorials regarding DirectDraw in DirectX 9 (because it is no longer released with DirectX) or how to work around the depreciated functions.
HOW can I use this method (i.e. WaitForVerticalBlank)? WHAT should I Initialize? Do I need to use DirectShow to get to the IDirectDrawSurface multimedia interface? How would I do that? Would this lead me to IDirectDraw? Does it need to be initialized like I currently do to get the Direct3D object & device?
g_pD3D = Direct3DCreate9(D3D_SDK_VERSION);
Now I am able to render a .bmp by using IDirect3DSurface9* backbuffer; GetBackBuffer(...); StretchRect(...); and Present(...);
But again the time of display is not well synchronized with the TTL pulse. I determine this on an oscilloscope by comparing the output of a photodector against the TTL.
Thank you for your help!