It’s been I while since I used OpenGL with PyQt, for example in my live coding experiments with GLSL shaders. Those were still done with PyQt4 and the good old QGLWidget. In Qt5 the preferred way to render in OpenGL canvases is to use the new QOpenGL* classes. Those have the advantage that they provide a full collection of OpenGL drawing functions, so it is not necessary to import any external OpenGL library (like PyOpenGL) anymore. The disadvantage is that there is currently no convenient way to create and initialize such a window with a nice render function, as was provided by the QGLWidget.
I finally collected some code from the PyQt5 OpenGL examples and with some modification I was able to run it (from the snapshot of PyQt5 on Github). Their class OpenGLWindow provides what you need for the first steps, you can just subclass it and add your code to your own render() function. I added some more interesting shaders from here, et voilà le chocolat:
Time to connect this with some live coding…
Join my next Angular workshop at TUGA IT, May 18th, in Lisbon.