Multiple GL viewport FPS toy for understanding the impact of swap interval
C++ QMake
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
FPSCounter.cpp
FPSCounter.h
GL_QGraphicsView.cpp
GL_QGraphicsView.h
LogoGLWidget.cpp
LogoGLWidget.h
MainWindow.cpp
MainWindow.h
README.md
logo.cpp
logo.h
main.cpp
multiple_gl_viewport_fps_toy.pro

README.md

Multiple GL Viewport FPS Toy

This is a small test application I wrote and used to help me understand the impact of setting the various permutations of the following:

  • Setting swapInterval to 0 versus 1 ...
  • for top-level QOpenGLWidgets versus child QOpenGLWidgets ...
  • for the QOpenGLWidgets themselves vs via the static method QSurfaceFormat::setDefaultFormat.

My conclusion after developing and experimenting with this tool on the various desktop platforms supported by Qt5 is that, in the case where you have more only one visible QOpenGLWidget instance, QSurfaceFormat::setDefaultFormat with swap interval 1 is fine if you wish to avoid drawing frames that will never be displayed. However, it is important to call QSurfaceFormat::setDefaultFormat with swap interval of 0 before making any QOpenGLWidgets if more than one QOpenGLWidget will ever be visible simultaneously. Failure to do so incurs serious performance degredation, limiting FPS to (# of visible QOpenGLWidgets) / (screen refresh rate).