Sign in to follow this  
Africa

Fast scrolling Graph using DirectX 3D

Recommended Posts

I need to draw data I receive from equipment at 200 samples per second. Each sample has 1200 points in it. Each point has a value that maps to a colour. I draw the latest sample at the bottom of the control. Every time I receive a new sample, all the previous samples are moved up to make place for this new sample. The user will see data scrolling upward. The important data will have a vivid colour that brings it out between the noise. I’m fixed to DX9 because I want to support Windows XP and maybe Windows 2000. Then I want to be ready for Vista and Windows 7. On XP DirectDraw7 used to be fast, but now on Vista its way to slow. Currently I draw the bottom row using vertex buffers and I use CopyFromScreen to scroll previous drawings upwards. This gives me fairly good performance but if another window is above my control, that window also gets scrolled upwards. As life goes, this was discovered close to the end of the project. Wet pants. I tried to fix it by drawing all samples using vertex buffers, and then move the camera. This did not work fast enough because I have to redraw everything. I need to go at 30fps. I’m only getting 3fps and a hot CPU. I tried using the Backbuffer’s surface but can’t seem to copy when the source and destination surfaces are the same. Here I’m not very confident how correct my approach was. Maybe I tried to access it at the wrong time. I’m an old C++ programmer but moved to C++.NET when VS2005 arrived. I’m not too bothered about the .NET SDK. I can always write an ATL control to use in my .NET applications. Please help.

Share this post


Link to post
Share on other sites
One rule of Direct3D is that you should always repaint the whole window and don’t try to play dirty tricks. This will bite you back sooner or later.

As most of you screen is unchanged between frames (just moved one pixel up) I would recommend the following approach. After you have rendered the new line copy your back buffer to a texture. In the next frame first render this texture (one line up) in the back buffer. Then add the new line and copy the back buffer again to the texture. You can then repeat this over and over again. This way you need only transfer the data for the new line to the GPU.

If you don’t use dynamic resources for the new data yet you should do this as this should give some more performances.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this