From 5d7dd101f2d70d3838431036ad91757706c6cb4b Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sat, 17 Jul 2021 10:21:26 +0800 Subject: [PATCH] load matrix instead of multiplying to identity --- pyqtgraph/opengl/GLViewWidget.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pyqtgraph/opengl/GLViewWidget.py b/pyqtgraph/opengl/GLViewWidget.py index 71768b6a..e80ae57b 100644 --- a/pyqtgraph/opengl/GLViewWidget.py +++ b/pyqtgraph/opengl/GLViewWidget.py @@ -155,9 +155,7 @@ class GLViewWidget(QtWidgets.QOpenGLWidget): def setProjection(self, region=None): m = self.projectionMatrix(region) glMatrixMode(GL_PROJECTION) - glLoadIdentity() - a = np.array(m.copyDataTo()).reshape((4,4)) - glMultMatrixf(a.transpose()) + glLoadMatrixf(m.data()) def projectionMatrix(self, region=None): if region is None: @@ -183,11 +181,9 @@ class GLViewWidget(QtWidgets.QOpenGLWidget): return tr def setModelview(self): - glMatrixMode(GL_MODELVIEW) - glLoadIdentity() m = self.viewMatrix() - a = np.array(m.copyDataTo()).reshape((4,4)) - glMultMatrixf(a.transpose()) + glMatrixMode(GL_MODELVIEW) + glLoadMatrixf(m.data()) def viewMatrix(self): tr = QtGui.QMatrix4x4()