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

How to keep the FPS stable at 60fps when using QML to draw animations



  • Hi,
    I‘am developing an QT Cluster App by QML on an 8Gb Board like below:

    1. Using two QML's Canvas to draw Cluster animations
    2. Set QQuickWindow::setSceneGraphBackend(QSGRendererInterface::OpenGL)
    3. Calling method requestPaint() from c++ thread to render Cluster page per 16ms by asynchronous way.

    When running QT Cluster App, the FPS of Cluster is about 30-40fps and it is not stable. After tuning, we found there are some reasons caused the low FPS, the main reasons are below:

    1. Render rate(16ms)
    2. Multi Canvas

    But if we reduce the render rate to 100ms or more, although FPS will up to 60fps, but the QT Annimations looks very slow.
    So, I want to confirm that if there any way to keep my App's FPS stable at 60fps when setting the render frequency as 16ms .
    By the way, the OS and S/W are below:
    OS:

    1. QNX Hypervisor
    2. QXN Host(QT Cluster App) + Guest Android(IVI Launcher App)

    S/W:

    1. QT open source Library 5.11.2
    2. Qtcreator 4.11.1

    that's all.



  • I tried the Qt5.14.2\Examples\Qt-5.14.2\quickcontrols\extras\dashboard in my enviornment. I fount it runs in scope 55-60fps.
    I found there is a module named "QT for mcu" in QT site. And I found some demos runs smoothly with it.
    Should I use the "QT for mcu" library to improve my Cluster app?


  • Moderators

    Hi @QTAndy

    using a Canvas element seems like one of the slowest way to implement custom drawings.

    have you considered subclassing
    https://doc.qt.io/qt-5/qquickitem.html
    or
    https://doc.qt.io/qt-5/qquickpainteditem.html

    and doing your drawing directly in updatePaintNode ?

    In theory, that should be a lot faster!



  • @J-Hilk
    Thanks for your reply.
    I tried Scene Graph and used QQuickItem's updatePaintNode().
    It works well. The FPS has been improved although it is still less than 60fps.
    But the edges of the graphic are jagged.
    I tried setAntialiasing(true) and setSmooth(true), but they don't seem to work.
    Is there any method to fix this issue?


Log in to reply