I've run out of ideas and I need some help. Consider the following snippet (modified http://www.riverbankcomputing.com/pipermail/pyqt/2014-July/034542.html):
from OpenGL import GL
from PyQt5 import Qt
class GLWindow(Qt.QWindow):
def __init__(self):
super().__init__()
self.setSurfaceType(Qt.QWindow.OpenGLSurface)
self.context = Qt.QOpenGLContext()
self.context.setFormat(self.requestedFormat())
if not self.context.create():
raise Exception('self.context.create() failed')
self.create()
def exposeEvent(self, ev):
ev.accept()
if self.isExposed() and self.isVisible():
self.update()
def update(self):
self.context.makeCurrent(self)
GL.glClearColor(1.0, 0.0, 0.0, 0.0)
GL.glClearDepth(1)
GL.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT)
GL.glFlush()
self.context.swapBuffers(self)
app = Qt.QApplication([])
win = GLWindow()
widget = Qt.QWidget.createWindowContainer(win, None, Qt.Qt.Widget)
widget.show()
app.exec_()
No matter what OpenGL functions I call after makeCurrent(), they raise the following exception:
File "errorchecker.pyx", line 53, in OpenGL_accelerate.errorchecker._ErrorChecker.glCheckError (src\errorchecker.c:1218)
OpenGL.error.GLError: GLError(
err = 1282,
description = b'nieprawid\xb3owa operacja',
baseOperation = glClearColor,
cArguments = (1.0, 0.0, 0.0, 0.0)
)
Besides, none of PyQt5 OpenGL examples, except openglwindow.py, work.
I'm using Python 3.4.2 win32, PyQt5 5.3.2 and PyOpenGL 3.1.0. Any ideas? I've found that PyQt5 binary was probably built against OpenGL ES, but I don't know if that matters when using PyOpenGL calls.