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. Efficent drawing advise

Efficent drawing advise

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.2k 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.
  • G Offline
    G Offline
    GrahamL
    wrote on last edited by
    #1

    Hi
    My application needs to display a series of 'traces'.
    Each trace will consist of 5000+ points and there can be up to 50 traces.
    I would be grateful of some pointers on how to dot his in the most efficient way -
    QPainter on a widget
    Use of OpenGL
    QGraphicsScene
    Which of these will be the most efficient at displaying the data quickly?

    Thanks for you time

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      I would say the more data you need to draw the closer to the hardware you want to get and with the three options OpenGL is closest.

      Painting on a widget is done on CPU so it won't be very fast for that amount of data. With QGraphicsScene you pay (a little but still) for an overhead of encapsulating each item in a QGraphicsItem, which, again, with that amount of data can get slow.
      With pure OpenGL you can just create a VBO with the points on the GPU and draw the whole thing with a single call.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Asperamanca
        wrote on last edited by
        #3

        For the amount of data you state, GraphicsView should do fine. There will be limitations eventually if you need to scale up further.

        Note also that in many cases, you can do some data reduction before the actual painting, because there's no way the user is going to see all of the points anyway. If you are zoomed in, you can disregard points outside the visible area. If you are zoomed out, you can compress the existing points into something that contains much less data, but will draw just the same curve.

        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