[PyQt] Using OpenGL in PyQt on Windows

alan moore me at alandmoore.com
Wed Mar 20 19:14:04 GMT 2019


I'm running windows 10 in a virtualbox machine with 3D drivers enabled.  
>From everything I've read, it *should* work with OpenGL.


However, I cannot find any way to get access to OpenGL functions.  On 
Linux I can do the following:

####### EXAMPLE

class OpenGLWidget(QOpenGLWidget):

     def initializeGL(self):

         # I can also specify a specific version using

         # QOpenGLVersionProfile on Linux

         self.gl = self.context().versionFunctions()

         print(type(self.gl))

######### END OF EXAMPLE


On Windows, I get an error printed to the console:

     versionFunctions: Not supported on OpenGL ES

And "self.gl" is None.


If I try to retrieve the functions self.context().functions(), I'm told 
that:

     QOpenGLContext object has no attribute 'functions'


If I try to directly create a QOpenGLFunctions object, I'm told that it 
doesn't exist (It should be part of QtGui according to the Qt docs, but 
doesn't exist on Windows or Linux).

I'm stumped.  How do I get my OpenGL functions object on Windows?



More information about the PyQt mailing list