Fastest way to do 2D line drawing?

I am currently working on a project in java which takes a bunch of seismic data, does a bunch of calculations, and ends up drawing (possibly millions) of lines to an image which is then displayed on screen. I originally did this by Paint()ing using a Graphics2D opject, but this is incredibly slow. It takes up to a few seconds to redisplay when just a few thousand lines are being displayed.

I know opengl is much faster, as I have been doing opengl in c for a few years now. My question is, what would the fastest way to do this line drawing? Would it be jogl? If not, which would be the fastest way to implement this within the standard java api?

I was plotting tens of thousands of points, and a few thousand lines using Graphics2D objects and saw long draw times as well (over a second).

I’ve rewritten all my code to use JOGL and I’m doing probably 50x faster. The visual quality isn’t quite as good (the java2d antialiasing is very nice!), but I’m much happier.

I have no experience with openGL from C, so I can’t give you a data point there.

-Ed

Hi, I’ve only been doing JOGL for a little while but am learning quite abit about it and 2D graphics would be much easier than what I’m involved in now. If I were to do it, I’d be looking at a starting off w/ a 2d app using either ‘display lists’ or ‘vertex arrays’ depending on whether or not the data (lines, etc…) are static or will change during run-time in some way. It sounds like your data will ‘refresh’ in some way as opposed to chaning dynamically so I’d probably be looking at vertex arrays but there is some efficiency required in reading in the arrays quick enough to render them fast.

These are covered in the red book as basics of opengl so I don’t think it would take you too long to get the hang of it. Some of the more experienced guys could probably give some better advice. BTW - I don’t think JOGL is the standard API for 2d apps, but I believe its’ on the fast track there.

Hi,

As Wizumwalt stated, I think that you can benefit at lot from jogl in your case with vertex arrays or even better VBO’s.
You will use all the capabilities of a good graphic card and the performances will certainly be a lot more better.

So, just give it a try.