[Qt-interest] QGLWidget context changes after QGraphicsView->setViewport(glwidget)

Florian Hänel heeen at gmx.de
Wed May 19 13:09:28 CEST 2010


Hello,

I've just stumbled over a problem with qGLWidget and QGraphicsView,
maybe someone can shed some light on this issue.

glWidget = new QGLWidget(QGLFormat(QGL::SampleBuffers));

glWidget->makeCurrent();
glewInit();
// create some OpenGL Objects

glWidget->doneCurrent();

guiview=new MyGraphicsView(this);

guiview->setViewport(glWidget); //changes QGLContext ... why?

//later:
MyGraphicsView::drawBackground()
{
//using previously created OpenGL objects fails...
}

So setting a QGLWidget as the viewport of a graphicsview replaces its
context with a new context, that doesn't share GL objects with the old
context. Why is that?

cheers,
Florian Hänel



More information about the Qt-interest-old mailing list