Solved

User Synchronization using WaitForVerticalBlank

Posted on 2006-06-13
3
1,025 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

17 Experts available now in Live!

Get 1:1 Help Now