Well... you can't draw in the middle of a pixel. If you scale up the painter, the precision should increase.
Well... you can't draw in the middle of a pixel. If you scale up the painter, the precision should increase.
I could suppose that QT can resample my pixmap using algorithm similar to one using for resizing...
Anyway, for now I've decided to use OpenGL which should be available in 90% cases with fallback to slow software rendering in other cases. On old machines without OpenGL even QPixmap approach can be too slow so I'll probably provide advances options to draw particles as points instead of circles.
Here is something to play with. Some parts of the code are commented and uncommenting some of them might change the behavior a bit.
The most important part is the one that makes sure the animation is "lag-undependent" - items will move properly regardless of the number of frames the hardware can handle.
Thanks ! GL version gives 25fps for me. In my case position calculation is more complicated: each frame is calculated in separate thread and calculation sometimes can be long. However frame time is adjustable so I'll try to follow your ideas and adjust it when rendering takes more time than calculations.
Bookmarks