Using OpenGL in PyQt on Windows

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using OpenGL in PyQt on Windows

Bugzilla from me@alandmoore.com
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?

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Using OpenGL in PyQt on Windows

Phil Thompson-5
On 20 Mar 2019, at 7:14 pm, alan moore <[hidden email]> wrote:

>
> 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.

I hadn't realised that ES didn't support versioned functions.

> 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).

The Qt docs describe the C++ API, not the PyQt API.

functions() isn't implemented in PyQt because it is recommended to use direct inheritance and inheritance of multiple wrapped classes is not supported.

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

As I've said many times before, I know almost nothing about OpenGL and need an expert to help ensuring the OpenGL support is properly usable - but nobody has ever stepped up.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Using OpenGL in PyQt on Windows

Bugzilla from me@alandmoore.com
On 3/23/19 7:46 AM, Phil Thompson wrote:
> On 20 Mar 2019, at 7:14 pm, alan moore <[hidden email]> wrote:
>
>> I'm stumped.  How do I get my OpenGL functions object on Windows?
> As I've said many times before, I know almost nothing about OpenGL and need an expert to help ensuring the OpenGL support is properly usable - but nobody has ever stepped up.
>
> Phil

I can appreciate the predicament, apologies if my question came off as
demanding.  Mostly I just wanted to know if this is how it is or if I'm
doing something wrong (I typically assume the latter).

I'm not much of an OpenGL expert myself; I know enough to know that I
can't blame anyone for not wanting to know more about it than they do. :-)

_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Using OpenGL in PyQt on Windows

Bugzilla from me@alandmoore.com
In reply to this post by Phil Thompson-5
On 20 Mar 2019, at 7:14 pm, alan moore <[hidden email]> wrote:
>> I'm running windows 10 in a virtualbox machine with 3D drivers enabled.  From everything I've read, it *should* work with OpenGL.
For the record, I was able to try this on a real Windows machine with a
decent GPU and had no problems running the code.  So it's apparently
only a problem on the VM.  Am I correct in my understanding that this
would be a limitation of the driver not supporting anything but OpenGL ES?
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Using OpenGL in PyQt on Windows

Phil Thompson-5
On 23 Mar 2019, at 8:02 pm, alan moore <[hidden email]> wrote:
>
> On 20 Mar 2019, at 7:14 pm, alan moore <[hidden email]> wrote:
>>> I'm running windows 10 in a virtualbox machine with 3D drivers enabled.  From everything I've read, it *should* work with OpenGL.
> For the record, I was able to try this on a real Windows machine with a decent GPU and had no problems running the code.  So it's apparently only a problem on the VM.  Am I correct in my understanding that this would be a limitation of the driver not supporting anything but OpenGL ES?

I think so.

Phil
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt
Reply | Threaded
Open this post in threaded view
|

Re: Using OpenGL in PyQt on Windows

Guðjón Guðjónsson
Hi Alan and Phil

OpenGL support in Virtualbox is experimental and disabled by default.
See section 4.5 in:
https://www.virtualbox.org/manual/ch04.html

I ran into the problem myself with an instrument with a control
program requiring OpenGL. I finally
got it working with Wine but I haven't tried enabling OpenGL in Virtualbox.

Regards
Gudjon
_______________________________________________
PyQt mailing list    [hidden email]
https://www.riverbankcomputing.com/mailman/listinfo/pyqt