Drawing circles very fast
-
I want to draw almost 50000 circles in a widget, but it must be done very bast. Because i am simulating sand falling in an empty recipient. and for to make it realistic the program must draw every frame in an interval of 1ms. It read the coordinates and the radius of the circles from a file.
Does somebody now a fast way to do it. I already tried with Direct2D and i got the same bad performance. Where is the performance leak. -
I suggest using OpenGL, you should get a nice performance boost since you don't have state changes - you render a single object - a circle. There is a very good video on optimizing OpenGL rendering in Qt here:
https://qt-project.org/videos/watch/graphics-performance-best-practicesIt doesn't get any faster than this. Also, since Qt 4.8.0 OpenGL is multithreaded.
-
On my PC the good old quake 3 runs at 1200 FPS, which is less than 1ms per frame. However the display actually displaying that much is a whole different story, since it is limited at 120 FPS, so I only get one frame displayed for every 10 frames rendered.
It is certainly doable in terms of rendering. Displaying all the rendered data - not so much, the majority of displays are stuck at 60 Hz or about 16.6 msec.