[PyQt] How to get access to QOpenGLFunctions.glGetString from PyQt?

Phil Thompson phil at riverbankcomputing.com
Thu Jan 19 10:08:21 GMT 2017


On 19 Jan 2017, at 3:19 am, Russell Warren <russ at perspexis.com> wrote:
> 
> I'm trying to get a set of OpenGL strings using PyQt.  To make it clear what I'm trying to achieve, this is how I would do it via PyOpenGL (which is not available):
> 
> ```
> >>> from OpenGL.GL import glGetString, GL_VERSION, GL_RENDERER, GL_VENDOR
> >>> for s in (GL_VENDOR, GL_RENDERER, GL_VERSION):
> ...     print(glGetString(s))
> ... 
> b'NVIDIA Corporation'
> b'Quadro FX 3700M/PCIe/SSE2'
> b'3.3.0 NVIDIA 340.96'
> ```
> 
> This *should* be achievable through Qt/PyQt with the use of `glGetString()` in the `QOpenGLFunctions` class [1], but I'm having several PyQt problems following the Qt docs for using this.
> 
> The first issue is that I can't locate `QOpenGLFunctions` anywhere in PyQt... where is it?
> 
> The second issue is that `QOpenGLContext` instances are supposed to have a `functions()` method that provides an easily accessible instance of `QOpenGLFunctions` (for ad-hoc usage, per Qt docs), but it does not exist on contexts created in PyQt.
> 
> How do I get a hold of `QOpenGLFunctions` via PyQt?  Alternatively, is there some other PyQt way to get the OpenGL strings that I want?

Have you looked at the PyQt OpenGL examples?

Phil


More information about the PyQt mailing list