Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I do fast animation without dropping frames?

How can I do fast animation without dropping frames?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.4k 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.
  • J Offline
    J Offline
    Jonathan
    wrote on last edited by
    #1

    I have an application that generates a stream of mathematically created scenes. As soon as each scene is created I want to render it.

    As normal, the actual rendering is done in a subclass of QWidget by overriding the paintEvent() method.

    The scenes are created in a separate thread. As soon as a new scene is created I call update() on the QWidget subclass. I have to call update() rather than repaint() because the latter can't be called from a different thread. Unfortunately update() can be called multiple times before a scene is rendered, hence the reason I'm losing scenes or getting only partial updates.

    I've tried syncing the scene creation thread with the renderer by waiting in the scene creation thread until QWidget::paintingActive() returns false. However this makes no difference.

    Further investigation suggests that QWidget::paintEvent() can execute multiple times without the screen being updated.

    Any ideas will be most welcome!

    (I'm developing on a laptop running Windows 7)

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jonathan
      wrote on last edited by
      #2

      I think I've solved my own problem. I used a QMutex object to ensure that a new scene couldn't be created whilst the old scene was being rendered and vice versa.

      However I'm not sure why waiting on paintingActive() didn't have the same effect.

      1 Reply Last reply
      0

      • Login

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