May 2019
Intermediate to advanced
542 pages
13h 37m
English
There are two Qt classes that we can use to display OpenGL content: QtWidgets.QOpenGLWidget and QtGui.QOpenGLWindow. In practice, they behave almost exactly the same, but OpenGLWindow offers slightly better performance and may be a better choice if you don't want to use any other Qt widgets (that is, if your application is just full-screen OpenGL content). In our case, we're going to be combining our OpenGL drawing with other widgets, so we'll use QOpenGLWidget as the base for our class:
class GlWidget(qtw.QOpenGLWidget): """A widget to display our OpenGL drawing"""
To create OpenGL content on our widget, we need to override two QOpenGLWidget methods:
Read now
Unlock full access