Fast scrolling Graph using DirectX 3D

Started by
0 comments, last by Demirug 14 years, 9 months ago
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.
Advertisement
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.

This topic is closed to new replies.

Advertisement