Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
4.4.0
-
None
Description
QGLPixelBuffer: This relies on a QGLWidget being available, if there isn't one it creates one, therefore in multithreaded apps, a QGLWidget should be created in the main thread before the thread using the pixel buffer is started to prevent an issue. Also, makeCurrent() needs to be called on that QGLWidget before the QGLPixelBuffer is created in the other thread.
Example (which worked for me at least)
#include <QtOpenGL>
class MyThread : public QThread
{
public:
MyThread(QGLWidget *gl, QObject *parent = 0) : QThread(parent), glx(gl) {}
protected:
void run()
private:
QGLWidget *glx;
};
int main(int argc, char **argv)
{
QApplication a(argc, argv);
QGLWidget gl;
MyThread t(&gl);
t.start();
return a.exec();
}