Important: Please read the Qt Code of Conduct -

Problem with shared QGLWidget and contexts

  • Hi all,

    We're currently fighting the following Qt warning "QOpenGLContext::swapBuffers() called without corresponding makeCurrent() ".

    We have several QGLWidgets visible at the same time. No multi-threading used. There also is an invisible QGLWidget which is used as share widget for the other OpenGL Widgets.

    We are getting the warning message each frame in one of our widgets where we try to render an overlay using QPainter like this:

    QPainter painter(this);
    painter.setFont( font );
    painter.setPen( Qt::NoPen );
    painter.setBrush( textColor );
    QPainterPath path;
    path.addText( textPos, font, text );
    painter.drawPath( path );

    We call makeCurrent() at the top of the paintGL() function. So the context should be set correctly.

    Does anyone have an idea or hint on how to fix this or an answer why we are seeing this warning?

    Cheers and thanks a lot! ;)

  • Have the same issue, also with multiple shared contexts.

    We're doing drawing in paintGL(), wrapped in a beginNativeRendering/endNativeRendering and overlays using after that.

    (Using Qt-5.2.1)

Log in to reply