ben8coast

I've been looking at many of the questions regarding drawing 2d lines and played with the example for drawing points, lines and other 3d primitives in the help section.

However I'm wondering what the most sensible (and preferably simple) way to draw what would essentially be an oscilloscope: that is a line that is refreshed a small section at a time.

Options I have thought of are:

1. Creating an array of points (vertexes) then filling them sequentially and removing those that are a few ahead of where the updated ones are going.

2. I have done this previously - in C++ and as part of a windows form by scrolling a bitmap through just writing (bitblt) a small part at a time. I gather this won't really work under XNA.


My question is will option 1 be too slow - because I'll be drawing at least 2 and preferably 3 at a time. So if they are 800pixels wide I'm drawing 2400 points every frame.

What I'm trying to do is redo an old ECG simulator (thats EKG for some of you) that I wrote some years ago.

Thank you


Re: XNA Game Studio Express Scrolling oscilloscope in 2d

Jim Perry

Number 2 would work fine using XNA and would be the easiest and probably best looking solution.




Re: XNA Game Studio Express Scrolling oscilloscope in 2d

Shawn Hargreaves - MSFT

I suspect both of those would work.

Drawing an array of 2400 points will be totally fast enough, as long as you do this in a single call (DrawUserPrimitive from a single array). It would be slow if you called DrawUserPrimitive 2400 times, once for each point, though.