Results 1 to 4 of 4

Thread: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.

  1. #1
    beetleskin Guest

    Default Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.

    Hi,

    I'm working on a project in which I have to draw a QGLWidget with constant 60fps. I addition, some textures within the GL-context are changing frequently.

    I want to separate that to tasks into two threads, one for the fast-refreshing GL-context and one for texture update and other things. The last one should be the main QApplication thread. I had two approaches of implementing that structure but both result in the error message: QGLContext::makeCurrent(): Failed.

    With the first try I basically followed this tutorial:
    http://doc.trolltech.com/qq/qq06-gli...glapplications

    The second one was to wrap the QGLWidget in a thread, constantly calling the widgets updateGL() function.

    I didn't come as far as safely updating the textures as I get the error right after initialization.

    I'm workin on Ubuntu, so I called XInitThreads() first.

    Does someone have an idea why the makeCurrent fails? Or even a better workaround for the general task?

    Thanks.

  2. #2
    Join Date
    May 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.

    Hi beetleskin
    I'm trying to do the same thing and get the same error related to QGLContext::makeCurrent() failed. Have you been able to resolve this problem? If so please share it with me cos that would really help me.

  3. #3
    Join Date
    Jun 2011
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.

    I too am in the same boat. Any help is greatly appreciated.

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.

    If I understand correctly, you want to use QWidget-based class outside main GUI thread. Well, I think its not a good idea:
    Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread.
    Next thing:
    two threads, one for the fast-refreshing GL-context and one for texture update and other things. The last one should be the main QApplication thread.
    I think that the first one should be in main thread, create a separate thread to play with the textures and pass the result to main thread for display.
    Let the main thread handle the display, gl-context refreshing or whatever. Manipulate the image data in other thread, if it needs some heavy processing, and send processed images for display to gui thread.

Similar Threads

  1. QGLContext problems
    By bhuang in forum Qt Programming
    Replies: 1
    Last Post: 25th August 2010, 09:18
  2. QGLContext Issue
    By parmar in forum Qt Programming
    Replies: 5
    Last Post: 18th June 2010, 11:25
  3. QGLWidget makeCurrent & makeOverlayCurrent
    By chameleon in forum Qt Programming
    Replies: 0
    Last Post: 9th May 2010, 15:05
  4. Single QGLContext across multiple QGLWidgets
    By pseudosig in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2008, 00:13
  5. overlay QGLContext
    By showhand in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2007, 17:51

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.