I have a problem to render a QImage with a derived QOpenGLWidget class. If I create my own raw graphic everything works fine but I can't create a proper QOpenGLTexture. I see only some random pixel from memory. I tried a lot but it doesn't work. Here is my test code:
initializeGL()
initializeOpenGLFunctions();
glClearColor(0.0, 0.0, 0.0, 0.0);
glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glOrtho(0, this->width(), 0, this->height(), 0, 1);
glMatrixMode(GL_MODELVIEW);
glShadeModel(GL_FLAT);
paintGL()
mTexture->bind();
glDrawPixels(mTexture->width(), mTexture->height(), QOpenGLTexture::RGBA, GL_UNSIGNED_BYTE, mTexture);
loadImage()
mTexture = new QOpenGLTexture(QImage::fromData(image).convertToFormat(QImage::Format_RGBA8888));
"image" is a QByteArray and works fine in a QGraphicsView. So it seems that I am missing something.