Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt crushes when setting QGLContext current in separate thread
Forum Updated to NodeBB v4.3 + New Features

Qt crushes when setting QGLContext current in separate thread

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 680 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sasmaster
    wrote on last edited by
    #1

    Hi All.I am creating QGLWidget.Inside that widget I start a thread function inside which I create a new OpenGL context.Once I call makeCurrent() the app crushes.

    Here is my code:

    @
    
       bool GLThreadedWidgetBOOST::initialize(){
          
        //create context from inside thread
        QGLFormat format;
        format.setProfile(QGLFormat::CompatibilityProfile);
        format.setVersion(4,3);
        format.setDoubleBuffer(true);
        QGLContext *glContext=new QGLContext(format, this);
        if(!glContext->create()){
            qDebug()<< "Error creating context";
        }
        setContext(glContext);
        //make sure new context is current
    
        makeCurrent();
    
      }
    

    @

    What am I doing wrong?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      sasmaster
      wrote on last edited by
      #2

      Ok,solved,the problem was I didn't call the super class constructor in the initialization list.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved