Efficent drawing advise
GrahamL last edited by
My application needs to display a series of 'traces'.
Each trace will consist of 5000+ points and there can be up to 50 traces.
I would be grateful of some pointers on how to dot his in the most efficient way -
QPainter on a widget
Use of OpenGL
Which of these will be the most efficient at displaying the data quickly?
Thanks for you time
I would say the more data you need to draw the closer to the hardware you want to get and with the three options OpenGL is closest.
Painting on a widget is done on CPU so it won't be very fast for that amount of data. With QGraphicsScene you pay (a little but still) for an overhead of encapsulating each item in a QGraphicsItem, which, again, with that amount of data can get slow.
With pure OpenGL you can just create a VBO with the points on the GPU and draw the whole thing with a single call.
Asperamanca last edited by
For the amount of data you state, GraphicsView should do fine. There will be limitations eventually if you need to scale up further.
Note also that in many cases, you can do some data reduction before the actual painting, because there's no way the user is going to see all of the points anyway. If you are zoomed in, you can disregard points outside the visible area. If you are zoomed out, you can compress the existing points into something that contains much less data, but will draw just the same curve.