Results 1 to 8 of 8

Thread: QGLWidget updateGL()

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QGLWidget updateGL()

    Quote Originally Posted by Lele
    I want to do it synchronously in order to prevent another memcpy of the buffer, I'd like to receive the buffer pointer and write the content directly to the framebuffer of the graphic board. (the display must be as fast as possible, now I have to use update() )
    But there's no way to make OpenGl calls work when called from external thread.
    It doesn't have to be a synchronous call. Buffers can be allocated dynamically and pushed onto a list or something like that...

    Worker thread:
    Qt Code:
    1. MyBufer *b = new MyBuffer();
    2. b->fillWithData(somedata);
    3. mutex.lock();
    4. bufferqueue.push(b);
    5. mutex.unlock();
    6. //...
    To copy to clipboard, switch view to plain text mode 

    Main thread:
    Qt Code:
    1. mutex.lock();
    2. MyBuffer *buf =bufferqueue.pop();
    3. bufferqueue.clear(); // clear unused items (aka "skip frames")
    4. mutex.unlock();
    5. Display(buf);
    6. //...
    To copy to clipboard, switch view to plain text mode 

    Of course the code is simply an idea and not a complete solution. Another possibility would be to use custom events instead of the queue.

  2. The following user says thank you to wysota for this useful post:

    Lele (30th May 2006)

Similar Threads

  1. about QGLWidget and QPainter
    By showhand in forum Qt Programming
    Replies: 5
    Last Post: 12th November 2008, 11:45
  2. [qt4,win,g++] QPainter on a QGLWidget
    By jh in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2008, 07:29
  3. QGLWidget renderText problem
    By mbjerkne in forum Qt Programming
    Replies: 1
    Last Post: 7th April 2006, 22:35
  4. QGLWidget, toolbox and paintGL()
    By mickey in forum Qt Programming
    Replies: 3
    Last Post: 21st March 2006, 02:05
  5. qGLWidget
    By mickey in forum Newbie
    Replies: 8
    Last Post: 24th February 2006, 01:30

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
  •  
Qt is a trademark of The Qt Company.