[Qt-interest] Drawing huge amounts of data into a waterfall

Valentina Masi valentina.masi at altran.it
Fri Dec 18 09:58:00 CET 2009


Thanks for your suggestion. I don't know OpenGL and I have a very short time to implement my application. So, if you could post some example code, it will be appreciated very much.

Thanks
Valentina
  ----- Original Message ----- 
  From: Brad Howes 
  To: Valentina Masi 
  Cc: Qt-interest at trolltech.com 
  Sent: Thursday, December 17, 2009 5:22 PM
  Subject: Re: [Qt-interest] Drawing huge amounts of data into a waterfall


  On Dec 17, 2009, at 10:16 AM, Valentina Masi wrote:


    I am developing an application drawing a huge amount of data: every 250ms my application receives a new array of 2731 floats and has to update a waterfall chart moving down the chart content of 1 pixel and showing a new line (of 2731 points) at the top of the chart.
    In order to do this, I have created a custom widget extending QWidget and overridden paintEvent handler. My problem is that running my application is too selfish in term of CPU and gets very slow just after a few seconds.


  Use the Qt OpenGL classes and create two offscreen buffers of the size of your drawing area. You will ping-pong the buffers so that the past frame becomes the data to use in the new frame only shifted up one line. You then draw the new data into the remaining line. I've done this for a high-speed spectrograph application and it works great and is very fast. It is tricky to get all of the OpenGL instructions just right, but when you do it screams. I've used this to show the results of 512 FFTs on complex 2K samples arriving at 400 Hz no problem




------------------------------------------------------------------------------




  Brad



  -- 
  Brad Howes
  Group 42
  MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
  Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420




------------------------------------------------------------------------------


  On Dec 17, 2009, at 10:16 AM, Valentina Masi wrote:

  > I am developing an application drawing a huge amount of data: every 250ms my application receives a new array of 2731 floats and has to update a waterfall chart moving down the chart content of 1 pixel and showing a new line (of 2731 points) at the top of the chart.
  > In order to do this, I have created a custom widget extending QWidget and overridden paintEvent handler. My problem is that running my application is too selfish in term of CPU and gets very slow just after a few seconds.


  Use the Qt OpenGL classes and create two offscreen buffers of the size of your drawing area. You will ping-pong the buffers so that the past frame becomes the data to use in the new frame only shifted up one line. You then draw the new data into the remaining line. I've done this for a high-speed spectrograph application and it works great and is very fast. It is tricky to get all of the OpenGL instructions just right, but when you do it screams. I've used this to show the results of 512 FFTs on complex 2K samples arriving at 400 Hz no problem



  Brad

  -- 
  Brad Howes
  Group 42
  MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
  Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091218/5977cb9c/attachment.html 


More information about the Qt-interest-old mailing list