Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-2431

QGLPixelBuffer: This relies on a QGLWidget being available, if there isn't one it creates one

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: P3: Somewhat important P3: Somewhat important
    • Some future release
    • 4.4.0
    • Documentation
    • None

      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()

      { glx->makeCurrent(); QGLPixelBuffer::hasOpenGLPbuffers(); }

      private:
      QGLWidget *glx;
      };

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      QGLWidget gl;
      MyThread t(&gl);
      t.start();
      return a.exec();
      }

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            jerome.pasion Jerome Pasion
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes