[PyQt] Opengl examples does not work on Windows

Kamil Okrasa kamokr at gmail.com
Fri Dec 12 11:20:11 GMT 2014


2014-12-12 10:33 GMT+01:00 Arjen Hiemstra <a.hiemstra at ultimaker.com>:
> On 11 December 2014 at 17:53, Kamil Okrasa <kamokr at gmail.com> wrote:
>> Hello all,
>>
>> Long story short, none of PyQt5 OpenGL examples, except
>> openglwindow.py, work on Windows. [1] does not work either. The code
>> raises OpenGL.error.GLError, err=1282, invalid operation on every
>> PyOpenGL call.
>>
>> I'm using Python 3.4.2 win32, PyQt5 5.3.2 and PyOpenGL 3.1.0 (with and
>> without _accelerate). Everything works fine on Linux with similar
>> setup. Examples also work fine in PyQt4 on both platforms. Any ideas?
>
> Are you talking about pure PyQt opengl, using Qt's QOpenGL classes, or
> PyOpenGL in combination with Qt?
>
> Qt on Windows currently uses ANGLE by default, which is a library that
> implements OpenGL ES on top of
> Direct3D. PyOpenGL unfortunately seems unable to deal with this. Using
> pure Qt OpenGL works for me,
> however, though it is not entirely straightfoward to get to work since
> there seems no easy way of inheriting
> QOpenGLFunctions using PyQt.
>
> Note that with Qt 5.4 Qt on Windows supports loading the OpenGL
> implementation dynamically[1]. This will
> most likely mean that PyOpenGL in combination with Qt will work again,
> though it can still break when Qt falls
> back to ANGLE. Qt 5.4 also has a mechanism to force desktop OpenGL to
> prevent this, but then you lose the
> fallback.

If I understand correctly:
- on Windows the Qt 5 pre-built binaries until 5.4 use ANGLE,
- rendering context created by ANGLE is most probably not compatible
with PyOpenGL,
- from 5.4 the default build dynamically chooses OpenGL
implementation, preferring OpenGL 2.0.

It seems to me that I should build 5.4 or 5.3 with "-opengl desktop"
option (or default build for 5.4) which will cause it to use OpenGL
2.0 implementation instead of ANGLE, and then build PyQt against it.
Am I right?

- Kamil


More information about the PyQt mailing list