Results 1 to 4 of 4

Thread: OpenGL rendering in separate thread, Qt 5.0.1

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2013
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default OpenGL rendering in separate thread, Qt 5.0.1

    Hi,

    I use Qt 5.0.1 and tried demo http://qt-project.org/doc/qt-4.8/dem...ypnotizer.html. It doesn't work on 5.0.1 because glWidget->makeCurrent() function in GLPainter::start() leads to the assertion "Cannot make QOpenGLContext current in a different thread" and crash. I added string

    context()->moveToThread(&glThread);

    to GLWidget::startRendering() before calling connect and this almost fixed the demo - it works stable if only one MDI window is opened and almost always crashes if I try to create new window with new thread. Also it is complaining a lot in the application output like this:

    QGLShader::link: "(45,20): warning X3206: implicit truncation of vector type
    QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent
    QBackingStore::flush() called with non-exposed window, behavior is undefined
    QGLShader::link: "(45,20): warning X3206: implicit truncation of vector type
    QWidget::repaint: It is dangerous to leave painters active on a widget outside of the PaintEvent


    etc etc.

    I wander is it possible to make it work stable? Was it supposed to be enough in Qt 5.0.1 just to move QGLWidget context to the rendering thread before running it?

    I attached the hypnotizer demo with changes mentioned.
    Attached Files Attached Files

Similar Threads

  1. GUI Updates from separate Thread
    By sa5webber in forum Newbie
    Replies: 5
    Last Post: 16th June 2012, 20:08
  2. update widget from separate thread
    By method in forum Qt Programming
    Replies: 5
    Last Post: 10th July 2009, 14:33
  3. Accesing widgets from separate thread
    By msmihai in forum Qt Programming
    Replies: 2
    Last Post: 8th December 2008, 11:48
  4. new QWidget in separate thread
    By magland in forum Qt Programming
    Replies: 15
    Last Post: 7th February 2008, 12:32
  5. handling paintGL in a separate thread
    By al101 in forum Qt Programming
    Replies: 1
    Last Post: 15th May 2007, 17:04

Tags for this Thread

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.