Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Performance issues animating hundreds of OpenGL shapes



  • Hi!
    I am doing some tweening to animate OpenGL shapes in a QOpenGLWindow, but then I have between 100 and 10000 objects that I need to animate.

    I've used QPropertyAnimation, so far, but the rendering is very, very slow. There is some stuttering in the render, and it seems to use a lot of CPU. Should I use a lower-level approach instead? Is it the fact that I am using Qt properties or the rate of the update of the numbers, that make it slow? Also, I am using one QPropertyAnimation for the x position and another one for the y position of the objects. Maybe I should merge them, or so.

    Here is some of my code: https://github.com/interferences-at/mpop-all/blob/feat-qopenglwindow/mpop_dataviz/prisonerline.cpp#L45 - this link might not be valid anymore in the future, but you might be able to find a similar file name in the same repository under a different branch.

    Instead of using QPropertyAnimation - which is quite high-level, I could use:

    • a single QTimer for all the groups of object that need to be animated;
    • a QEasingCurve for each property to animate

    Would it be more performant this way?

    Thanks!


Log in to reply