Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / d3d_line - fastest way to draw many many lines to the screen?

Author
Message
Ben_UK78
16
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 7th Dec 2011 13:53
Hi All,

I have a part of one project that is plotting data to the screen.

I am currently using d3d_line to plot the lines and there are about 19,000 lines on the screen plotting pixel to pixel (data point to data point) and for multiple lines.

I am looking for a way to speed up the plotting of the lines.
I considered doing it myself by editing the screen memory manually, but I'd have to work out where to draw the line (working out the start and end points is easy enough). I don't know if this would result in much of a speed gain anyway.

Does anyone have any recommendations?

How do professional packages draw so many continuous lines to the screen without slowdown?

Thanks for any help.
TheComet
18
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 7th Dec 2011 14:09
Do you really need to update the drawing process every loop? Just draw the lines to an off-screen bitmap once, get the image and paste that to the screen. When you draw new lines, all you do is draw them to the bitmap and update the image. Removing lines is a little more complex, you'd have to draw all of the lines again.

If you're really looking for a way to speed things up even more, you can use multiple off-screen bitmaps, and then layer the resulting images over each other so it looks like you have one complete image. This way you'll never have to draw all of the lines at once.

TheComet

Ben_UK78
16
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 7th Dec 2011 15:04
Maybe. The lines update with new data, every few seconds or so.

The main thing is that the program only really displays the numbers and the lines. It's a graphical display of past data recorded from an array of sensors so it isn't doing much else.

Its just that on one screen where 15 channels can be plotted and the lines can be displayed at double line thickness therefore displaying nearly 40,000 lines on screen my laptop fps drops to around 15fps, so I wondered about other ways.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 7th Dec 2011 15:43
That sounds exactly like the circumstances that TC is talking about - why redraw everything if nothing has changed? And if the changes are restricted to one area of the display (such as if you have a time-axes along the bottom), then it should be fairly simple to arrange a scrolling area and to just redraw the changed area.

Ben_UK78
16
Years of Service
User Offline
Joined: 10th Jul 2010
Location:
Posted: 7th Dec 2011 17:49
I shall give it a try.

Thanks all...

Login to post a reply

Server time is: 2026-07-11 09:30:28
Your offset time is: 2026-07-11 09:30:28