<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Have you looked at the PyQt OpenGL examples?</blockquote><div><br></div><div>I had not. Thanks for the tip, I didn't know they were there.</div><div><br></div><div>However, they all run into this error:</div><div><font face="monospace, monospace" color="#351c75"><br></font></div><div><font face="monospace, monospace" color="#351c75">```</font></div><div><div><font face="monospace, monospace" color="#351c75">$ python hellogl.py </font></div><div><font face="monospace, monospace" color="#351c75">Traceback (most recent call last):</font></div><div><font face="monospace, monospace" color="#351c75"> File "hellogl.py", line 144, in initializeGL</font></div><div><font face="monospace, monospace" color="#351c75"> <a href="http://self.gl">self.gl</a> = self.context().versionFunctions()</font></div><div><font face="monospace, monospace" color="#351c75">ImportError: No module named 'PyQt5._QOpenGLFunctions_3_3_Compatibility'</font></div><div><font face="monospace, monospace" color="#351c75">Aborted</font></div></div><div><font face="monospace, monospace" color="#351c75">```</font></div><div><br></div><div>This is interesting since I actually ran into this exact problem before when hacking around and trying to use versionFunctions() to get a hold of a QOpenGLFunctions instance. I had thought that I was doing something incorrectly, since using versionFunctions() was a bit of a guess at alternative/available ways to access QOpenGLFunctions, and was not one of the recommended ways in the Qt docs. Here is the shortcut case for me getting that same error that I didn't post yesterday:</div><div><font face="monospace, monospace" color="#351c75"><br></font></div><div><font face="monospace, monospace" color="#351c75">```<br></font></div><div><div><font face="monospace, monospace" color="#351c75">>>> import sys</font></div><div><font face="monospace, monospace" color="#351c75">>>> from PyQt5 import Qt, QtWidgets, QtOpenGL</font></div><div><font face="monospace, monospace" color="#351c75">>>> app = QtWidgets.QApplication(sys.argv)</font></div><div><font face="monospace, monospace" color="#351c75">>>> glw = QtOpenGL.QGLWidget()</font></div><div><font face="monospace, monospace" color="#351c75">>>> glw.glInit()<br></font></div><div><font face="monospace, monospace" color="#351c75">>>> ctx = Qt.QOpenGLContext.currentContext()</font></div><div><font face="monospace, monospace" color="#351c75">>>> ctx</font></div><div><font face="monospace, monospace" color="#351c75"><PyQt5.QtGui.QOpenGLContext object at 0x7f55993718b8></font></div><div><font face="monospace, monospace" color="#351c75">>>> ctx.versionFunctions()<br></font></div><div><font face="monospace, monospace" color="#351c75">Traceback (most recent call last):</font></div><div><font face="monospace, monospace" color="#351c75"> File "<input>", line 1, in <module></font></div><div><font face="monospace, monospace" color="#351c75"> ctx.versionFunctions()</font></div><div><font face="monospace, monospace" color="#351c75">ImportError: No module named 'PyQt5._QOpenGLFunctions_3_3_Compatibility'</font></div></div><div><font face="monospace, monospace" color="#351c75">```</font></div><div><font face="monospace, monospace" color="#351c75"><br></font></div><div>As a side note, is there a quicker way to get a valid QOpenGLContext than that (instantiating and initializing a QGLWidget)? Looks like the OpenGL demos do it with QWindow.setSurfaceType(QWindow.OpenGLSurface).</div><div><br></div><div>Russ</div><div><br></div></div>
</div></div>