Results 1 to 3 of 3

Thread: Multiple custom engine rendering using QTimer in QWidget, conflict of multiple calls

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Multiple custom engine rendering using QTimer in QWidget, conflict of multiple calls

    Hi everybody,
    I have a custom QWidget class which does a Direct3D12 rendering using a QTimer to draw the frame.
    All works good but the problem is I have multiple instance of this widget, meaning multiple drawing of frame.
    The problem is QTimer is async so the call can be crossed between all these rendering.
    Is there a safe way in Qt to avoid this problem or I have to lock the main thread with a mutex for each drawing of frame?
    Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Multiple custom engine rendering using QTimer in QWidget, conflict of multiple ca

    I am not quite sure I understand your problem.

    All timers work on the thread they are created on, so if you create a timer in a widget it will run on the main thread.

    Do these multiple instances show the same content and you want them updated at the same time?

    Cheers,
    _

  3. #3
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Multiple custom engine rendering using QTimer in QWidget, conflict of multiple ca

    I was afraid of the QTimer can be executed in same time and then make a conflict but if you say that can never happen, then certainly it's safe.
    This is a QTimer which is not one-shot and which has the start using 0 as time parameter to have it refresh at maximum speed.
    Something I noticed is if I activate the VSync of the swap chain of Direct3D, I don't have the FPS lock at 60FPS.
    I tried to change the QTimer to one shot and start at the end of the frame rendering but still not 60FPS lock.
    Normally the VSync block the update at the end of the rendering and you have 60FPS...

Similar Threads

  1. Replies: 2
    Last Post: 31st May 2014, 17:15
  2. [MinGW] Multiple calls to qmake
    By Potch in forum Installation and Deployment
    Replies: 2
    Last Post: 21st December 2013, 08:30
  3. Replies: 1
    Last Post: 11th May 2012, 19:08
  4. Replies: 2
    Last Post: 19th October 2011, 10:30
  5. multiple QTimer::singleShot() calls?
    By mattc in forum Qt Programming
    Replies: 1
    Last Post: 27th July 2009, 20:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.