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

Russell Warren russ at perspexis.com
Thu Jan 19 03:19:23 GMT 2017


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?

Thanks,
Russ

[1] http://doc.qt.io/qt-5/qopenglfunctions.html#glGetString
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20170118/a6d46980/attachment.html>


More information about the PyQt mailing list