Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Qt3D: Synchronize with frame rate?
Forum Updated to NodeBB v4.3 + New Features

Qt3D: Synchronize with frame rate?

Scheduled Pinned Locked Moved Solved Game Development
2 Posts 2 Posters 1.4k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    Andreas E.
    wrote on last edited by
    #1

    Hello,

    is there a signal when Qt3D has finished rendering a frame or swaps the display buffers? What is the mechanism to synchronize animations with the actual frame rate?

    Thanks in advance

    1 Reply Last reply
    0
    • W Offline
      W Offline
      wrosecrans
      wrote on last edited by
      #2

      To get a per-frame callback, include QFrameAction and add one as a component to a node in your scene.

      #include <QFrameAction>
      #include <QEntity>
      ...
          Qt3DCore::QEntity *root;
      ...
          Qt3DLogic::QFrameAction *fa = new Qt3DLogic::QFrameAction;
          root->addComponent(fa);
          fa->connect( fa, SIGNAL(triggered(float)), &some_controller, SLOT(update()) );
      

      And the root node's FrameAction component will trigger the single every frame. In practice, I think you can probably also get about the same effect by making a QTimer with zero timeout. After rendering a frame, the mainloop will be idle and trigger the idle timer. But it won't be guaranteed to be entirely in sync.

      1 Reply Last reply
      2

      • Login

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