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. Fastest way to paint a lot of squares

Fastest way to paint a lot of squares

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 732 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.
  • M Offline
    M Offline
    meqto
    wrote on last edited by
    #1

    Hello,
    in my current project I have to draw a lot of squares (amount can vary between 100 and 2^27 (~10^8), which build a grid. Each square has a specific color (7 different colors) which is updated really fast and often (ca. 500Hz).
    Now I am searching for the most performant way to realise this.
    In an older version I used QGraphicsView and QGraphicsScene with a subclass of QGraphicsItem for each square, but the result was too slow and it looked not very smoothy.
    I know that the human can't really recognize 500 frames per second, but the update rate is that high and I simply want to display a smoothy picture which shows any greater change.
    What is currently the best Widget I have to choose? An OpenGL-Widget? With QGraphicsView or not? A lot of independent Widgets? I read of a new QQuickWindow. Is it possible to use this widget for my purpose?

    If you have any further questions or I wrote anything unintelligible, don't hesitate to ask.

    Thank you!

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      If you want fast graphics then go with OpenGL.

      However realise that beside the fact that the human eye/brain can't handle 500Hz refresh rate, there's currently no consumer device that does this either. Even current high-end graphics card don't provide such a refresh rate and no screens supports that.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • M Offline
        M Offline
        meqto
        wrote on last edited by
        #3

        Thanks for your answer and your advice. I will try out OpenGL.

        I know that 500Hz are too high for human senses, but I just wanted to mention the actual refresh rate of the state. You can't either see the single squares if there are 2^27 of them. I only want to see the approximate movement of square groups. So you don't actually need 500Hz, 50-60Hz would be more than enough (my monitor actually can''t display more FPS). But with my current implementation I have a refresh rate of ~2-3Hz. But yeah, you are right. I think I simply have to skip some states and draw only every tenth color of a square. That might be the weakness in my current version.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          It's a bit like video games: only draw precisely what a user can see closely and then start reducing the quality for what is behind until you can even drop what's far.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          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