Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with shared QGLWidget and contexts
Qt 6.12 LTS is out! See what's new in the release blog

Problem with shared QGLWidget and contexts

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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.setRenderHint(QPainter::Antialiasing);
    painter.setRenderHint(QPainter::HighQualityAntialiasing);
    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! ;)

    1 Reply Last reply
    0
    • U Offline
      U Offline
      u.hertlein
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt
      • Unsolved