Solved

User Synchronization using WaitForVerticalBlank

Posted on 2006-06-13
3
1,031 Views
Last Modified: 2013-12-08
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);
g_pD3D->CreateDevice(...);

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!
Matt




0
Comment
Question by:mbh5m
3 Comments
 
LVL 18

Accepted Solution

by:
JoseParrot earned 125 total points
ID: 16917671
Hi,

Great job with the oscilloscope! Like in the good times of electronics!
Well, after a so well arranged arguments, we have no other way than try to help you!

I had a similar problem, to synchronize a camera to a high definition display. The solution was to "downgrade" the system.

We don't need Windows xP to do that. Actualy Windows makes it worst; windows requires so much resources to itself, and is more and more abstract to hardware, that it is better to use an old DOS to do it.

If the application you have doesn't require Windows, or if you can separate dedicated functions to other machine, don't use the wasteful and angry Windows. You can put an inexpensive PC devoted to the function with DOS and all TSR you want, programmed in pure C (not C++, just C).

If National doesn't have device drivers to DOS, may be Directx lower than 9 could be the other option.

Jose
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, in one of the tech-blogs I usually read, I saw a post about the best-selling video games through history. The first place in the list is for the classic, extremely addictive Tetris. Well, a long time ago, in a galaxy far far away, I was…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now