Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML and Qt c++ Vsync and Tearing Problems - Summary of possible Solutions
Forum Update on Monday, May 27th 2025

QML and Qt c++ Vsync and Tearing Problems - Summary of possible Solutions

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 7.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qtd1d1
    wrote on 21 Nov 2011, 15:11 last edited by
    #1

    Hi everyone,

    I started a project to use QML (UI) and QT C++(Logic) on embedded devices (right now I am using the i.MX53).

    My animation is quite simple: I am moving a few images and fade them in and out.
    During this animation tearing appears. OpenGL is used to benefit from hardware accerlation.

    I read a few blogs and forum posts regarding similar problems.
    First, I would like to summarize the problems and possible solutions I found (as far as I understood it correctly)

    Short description of tearing from wikipedia:
    Screen tearing is a visual artifact in video where information from two or more different frames is shown in a display device in a single screen draw.
    The artifact occurs when the video feed sent to the device isn't in sync with the display's refresh, be it due to non-matching refresh rates, or simply lack of sync between the two. During video motion, screen tearing creates a torn look as edges of objects (such as a wall or a tree) fail to line up.

    Example, how it looks like:
    !http://tdistler.com/wp-content/uploads/2010/07/v_sync.jpg!

    Problems:

    1. QML is facing right now VSYNC problems.
      -> These problems are known by the Qt Development team and they will fix them in the Qt5.0 release.

    Possible Solutions:

    1. Use QMLSceneGraph
      1.1 Qt 4.8 with QML 2
      "http://ilkka.github.com/blog/2011/03/04/qtquick_2_scenegraph_glsl_fragment_shader_tutorial/"
      1.2 Qt 5.0 with QML 2
      "http://zchydem.enume.net/2010/11/01/playing-with-qt-scene-graph/"

    2. Write own QGLWidget and override the paint() function
      Set autoswapbuffers to false and swapbuffers manually.
      Try to fake the algorithm of QMLSceneGraph:
      @while (animationIsRunning) {
      paintQMLScene();
      swapAndBlockForNextVSync();
      }@

    Original source: "velvet and the qml scene graph":http://labs.qt.nokia.com/2010/12/02/velvet-and-the-qml-scene-graph/

    1. Should work, but doesn't for me:
      @QGLFormat fmt = QGLFormat::defaultFormat();
      fmt.setSwapInterval(1);@

    Questions and Problems regarding the solutions:

    Did somebody face similar or the same problems I did and solved it ?

    1.1 I managed to install Qt 4.8 and add QML2, but when I am executing the project then I get always the same error message:
    QDeclarativeView only supports loading of root objects that derive from QGraphicsobject
    1.2. I couldn't manage to install Qt 5.0 from the repository, but I am able to find some videos and blog post which proof that it should work and that I am the problem .. ;)
    2. I tried to implement my own QGLWidget, but right now I can't figure it out how to do it. I do not understand how the qml elements are communicating with the Qt c++ paint() function of Opengl.
    3. Easiest way but doesn't work for me. It's explained in the velvet qt labs post.

    I can't imagine that I am the only one who has this problems, thats why I tried to share my small experience about this topic with the community.

    Thanks.

    1 Reply Last reply
    0

    1/1

    21 Nov 2011, 15:11

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved