Results 1 to 4 of 4

Thread: Dynamic Data Display with OpenGL

  1. #1
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Dynamic Data Display with OpenGL

    Hi, all
    I want to draw series wiggle lines with OpenGL in Qt4. As we all know, the doubleBuffer is 'on' by default in Qt4. So I think the QGLWidget will be the fittest to me. But the effect is not good and the screen is flicker.
    My method is refresh the the whole GL scene when the data is changed which is generated by a functin of rand. Please looked at the attachment which are some code. Is anyone would help me or have some other good idear?
    Attached Files Attached Files
    There is no secret in the face of the code.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic Data Display with OpenGL

    Why do you delete all those arrays and create them again every 40 ms (in A::advanceData())? Can't you just fill them with new data?

    Recreating the display list might also have some impact on performance. You redraw your widget 25 times per second, so probably that display list is used only once --- try to draw directly.

    Qt Code:
    1. this->wiggleData=(float**) new float [10000];
    To copy to clipboard, switch view to plain text mode 
    This should be:
    Qt Code:
    1. wiggleData = new (float*)[10000];
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Dynamic Data Display with OpenGL

    advanceData() is the slot with a 'timer' and it will be called per 40 ms. I must delete all the arrys and recreate them void losing the EMS memory. And could you tell me your method about the directly draw. Thanks a lot!
    There is no secret in the face of the code.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic Data Display with OpenGL

    Quote Originally Posted by showhand
    I must delete all the arrys and recreate them void losing the EMS memory.
    No, you don't --- you just waste time. Look:
    Qt Code:
    1. if(movieData)
    2. {
    3. for(int i=0;i<traceNum;i++)
    4. delete []movieData[i];
    5. delete []movieData;
    6. }
    7. movieData=(float**) new float [XNum];
    8. for(int i=0;i<XNum;i++)
    9. {
    10. movieData[i]=new float[YNum];
    11. for(int j=0;j<YNum;j++)
    12. {
    13. movieData[i][j]=0.0;
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 
    Each time this code is run, you delete all of the arrays just to create new ones of the same size. Can't you reuse them?

    Quote Originally Posted by showhand
    And could you tell me your method about the directly draw.
    Just remove the code related to display lists and invoke A::movieWiggle() from A::paintGL().

Similar Threads

  1. real time data display
    By hammer256 in forum Qt Programming
    Replies: 13
    Last Post: 25th March 2013, 17:47
  2. Replies: 8
    Last Post: 18th March 2011, 12:27
  3. Best way to display lots of data fast
    By New2QT in forum Newbie
    Replies: 4
    Last Post: 16th October 2008, 23:46
  4. Replies: 2
    Last Post: 29th September 2008, 01:08
  5. First attempt to display serial port data on GUI
    By ShaChris23 in forum Newbie
    Replies: 12
    Last Post: 4th May 2007, 10:14

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.