Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QOpenGLWidget on Mac: update is automatically called?
Forum Update on Monday, May 27th 2025

QOpenGLWidget on Mac: update is automatically called?

Scheduled Pinned Locked Moved General and Desktop
qopenglwidgetupdatemac
2 Posts 1 Posters 1.3k Views
  • 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.
  • F Offline
    F Offline
    floatingWoods
    wrote on 20 Aug 2015, 15:45 last edited by
    #1

    Hello,

    I have an openGl application that runs on Windows, Linux and Mac. Until recently, I used QGLWidget, but since I upgraded to Qt 5.5, I am now using QOpenGLWidget.
    Before, I had to swap buffers with QGLWidget::swapBuffers()
    Now, I swap buffers (or update the image after rendering was done) with QOpenGLWidget::update()

    This works fine on Windows and Linux, but on Mac (Yosemite), the rendering appears flickering, and incomplete. It is like update() is called automatically, also while a rendering is underway. Imagine, you want to display in every frame 3 cubes. So I do:

    render cube 1 ( glBegin(GL_QUADS), etc..., glEnd() )
    render cube 2
    render cube 3
    update()

    Above works as expected on Linux and Windows, but on Mac, sometimes I have only one cube displayed, othertimes, 2 or 3 (or none). And the colors are very bright (as if the color buffer accumulates 2-3 frames)

    This makes me think that internally, a swapBuffers() is called while I am still rendering (e.g. between cube 2 and cube 3).
    If I explicitely set the swap behaviour of the surface format to double buffer (i.e. surface.setSwapBehavior(QSurfaceFormat::DoubleBuffer) ), then the colors look ok, but the missing cubes problem remains (i.e. incomplete rendering display).

    Does anyone have a clue what is going on?

    If I revert back to using QGLWidget on Qt5.5, everything looks normal.

    Thanks for any insight

    1 Reply Last reply
    0
    • F Offline
      F Offline
      floatingWoods
      wrote on 20 Aug 2015, 16:16 last edited by
      #2

      I have a small update on this:

      If I call glFinish() after my rendering is done, then I can make it work right (given that I specified double-buffering, otherwise the colors appear way too bright).
      The downside is that with glFinish(), the rendering takes 30% longer..

      1 Reply Last reply
      0

      1/2

      20 Aug 2015, 15:45

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved