Important: Please read the Qt Code of Conduct -

QGLWidget vsync Mac

  • I am using CGLSetParameter(CGLSetCurrentContext(), kCGLCPSwapInterval, &val ) to activate vsync. It works but only for a few seconds. The animation is smooth at 60 fps for 3 - 5 seconds. Afterwards the framerate drops to 48 - 50 fps for a fraction of a second and runs smooth for the next few seconds and so on. You can notice this stutter in fps and video scrolling. In my opinion its more a Qt and not opengl problem, because in fullscreen all is fine. The only difference to the windowed display is the showFullScreen() call on the widget.

    Anyone an idea what is causing this? I am using a QTimer based event loop.

  • I have tested it under Linux. In a windowed mode, the vsync is not perfect too. Like mac, there is no problem in fullscreen. Using a glFinish() at the end of glPaint() works like a charm for linux in windowed mode.
    Using a glFinish() for mac make the above described problem even worse. Framerate drops to 30 for a fraction of a second.
    So don't know maybe it's a hardware problem with my mac.

    In Windows I am using directx. Never had problems with it in window mode or fullscreen.

  • Would be sweet to have something like CADisplayLink in Qt that would prompt for a redraw as fast as possible. Using a timer seems quite inefficient to me, although I have no idea how it performs under the hood.

Log in to reply