Results 1 to 2 of 2

Thread: QGLContext problems

  1. #1

    Default QGLContext problems

    I use the GLWidget class from the hellogl sample.

    In initializeGL(), I want to access the current QGLContext and call makeCurrent(), doneCurrent() to make it available to other rendering threads and make it unavailable to current thread.

    To do this, I call QGLContext::currentContext(). But the return type is a const* pointer, hence I can't call QGLContext::doneCurrent().

    If I instead create my own context via
    QGLContext* p = new QGLContext( QGLFormat::defaultFormat() );
    bool result = p->create();

    result is always 0. Same with other ways to construct QGLFormat.

    Thanks

  2. #2
    Join Date
    Aug 2010
    Posts
    4
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QGLContext problems

    From Qt 4.6 docs:
    Qt Code:
    1. void QGLContext::doneCurrent () [virtual]
    2. Makes no GL context the current context. Normally, you do not need to call this function; QGLContext calls it as necessary.
    To copy to clipboard, switch view to plain text mode 

    Problem is multiple threads accesing one GLWindget? QGLContext is not thread safe. Use other means of syncing and then use only QGLContext::makeCurent()
    it should do.

Similar Threads

  1. Single QGLContext across multiple QGLWidgets
    By pseudosig in forum Qt Programming
    Replies: 2
    Last Post: 22nd June 2008, 23:13
  2. overlay QGLContext
    By showhand in forum Qt Programming
    Replies: 3
    Last Post: 10th April 2007, 16:51
  3. QGLContext with multiple graphics cards
    By yuriy in forum Qt Programming
    Replies: 2
    Last Post: 11th September 2006, 15:35
  4. old problem with QGLContext and render pixmap
    By mickey in forum Qt Programming
    Replies: 14
    Last Post: 21st July 2006, 01:17
  5. Alpha channel weirdness with QGLContext
    By renaissanz in forum Qt Programming
    Replies: 2
    Last Post: 15th March 2006, 16:10

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.