[PyQt] glGetFloatv crashes application
Jonatan Magnusson
jonatan.magnusson at gmail.com
Mon Feb 6 22:33:35 GMT 2017
Den 2017-02-06 kl. 22:42, skrev Phil Thompson:
> I would describe the OpenGL support as very immature. Can you send me a short, complete example that demonstrates the problem?
Sure!
import sys
from PyQt5.QtWidgets import QWidget, QOpenGLWidget, QApplication,
QHBoxLayout
from PyQt5.QtCore import QSize
class GLView(QOpenGLWidget):
def minimumSizeHint(self):
return QSize(50, 50)
def sizeHint(self):
return QSize(400, 400)
def initializeGL(self):
self.gl = self.context().versionFunctions()
self.gl.initializeOpenGLFunctions()
def paintGL(self):
self.gl.glLoadIdentity()
self.gl.glTranslatef(1, 2, 3)
print("before")
m = self.gl.glGetFloatv(self.gl.GL_MODELVIEW_MATRIX)
print("after")
print(str(m))
def resizeGL(self, width, height):
self.gl.glViewport(0, 0, width, height)
class TestWindow(QWidget):
def __init__(self):
super(TestWindow, self).__init__()
layout = QHBoxLayout()
layout.addWidget(GLView())
self.setLayout(layout)
app = QApplication(sys.argv)
window = TestWindow()
window.show()
sys.exit(app.exec_())
Regards,
Jonatan
More information about the PyQt
mailing list