Qt crushes when setting QGLContext current in separate thread
General and Desktop
2
Posts
1
Posters
680
Views
1
Watching
-
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?