Sign in to follow this  
Salec

Rendering real-time ocsilliscope data

Recommended Posts

Hey guys, I've got a rather unique problem that has been nagging at me for some time. I need to display real-time 2d ocsilliscope data in a fast and effective way. There are two other requirements as well. A perfect example of what I need to do is located here: http://video.google.com/videoplay?docid=6698275370008552612&q=ECG+stock&hl=en Note the clear space representing the cursor and the fact that old data is retained on the screen until the cursor has cleared and redrawn that spot. This is exactly what I need to do. My original technique was to modify a texture on the CPU and each frame send the updated texture to the video card. This proved to be slow and ineffective when I had 6 wave forms on the screen. I then tried using a line pool but that proved in effective in that It could not achieve the visual effects I need (clear cursor and overwriting old waveforms). Any ideas/suggestions would be greatly appreciated. -Salec

Share this post


Link to post
Share on other sites
Interesting task [smile]

Do you have any hardware limitations - can you use modern features such as Shaders (particularly SM2/SM3)?

If so you might be able to generate modifications on the fly. Generating a spline in the VS is fairly simple and you can upload the control points as constants.

You can use stencil buffers to good effect here. If you draw existing and new data, but use the stencil buffer to toggle between them you've got a fairly fast and simple solution. Just change how you render to the stencil buffer in order to change the output...

You might, but not 100% sure, be able to use scissor-rect's to achieve the same sort of results.

Using render-to-texture effects will probably make it easier to re-use data.

Just a few ideas to get you started I hope..

hth
Jack

Share this post


Link to post
Share on other sites


I'm looking into render targets right now to try the render to texture idea. At first I thought render targets were fairly slow but I must of been wrong.

I could probably get away with SM2 as most DX9 cards seem to support it fine. SM3 is out since it's only on newer models.

Didn't think about using stencil buffers!

Share this post


Link to post
Share on other sites
I'd have a vertex buffer per trace that is treated as if it were a ring buffer when updating vertices. I'd draw the entire buffer contents each frame as a line strip.

Before drawing the traces, I'd draw a quad that is the size of the cursor, and the color of the background, with a z value that would place it in front of the traces. I'd then draw all of the traces with z testing enabled, which should leave the cursor area untouched.

This seems like the simplest way and should work on all hardware.

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