From 27199225848bf6a772d257cb631445fcb837bccd Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Tue, 16 Feb 2021 09:15:37 +0800 Subject: [PATCH] RawImageWidget.py : fix port to QOpenGLWidget Qt5 docs specify differences between QGLWidget and QOpenGLWidget: "...when invoking paintGL(). QOpenGLWidget sets up the viewport via glViewport(). It does not perform any clearing." --- pyqtgraph/widgets/RawImageWidget.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pyqtgraph/widgets/RawImageWidget.py b/pyqtgraph/widgets/RawImageWidget.py index 98cee889..a5a62691 100644 --- a/pyqtgraph/widgets/RawImageWidget.py +++ b/pyqtgraph/widgets/RawImageWidget.py @@ -134,6 +134,8 @@ if HAVE_OPENGL: glDisable(GL_TEXTURE_2D) def paintGL(self): + glClear(GL_COLOR_BUFFER_BIT) + if self.image is None: if self.opts is None: return @@ -144,9 +146,6 @@ if HAVE_OPENGL: if not self.uploaded: self.uploadTexture() - dpr = self.devicePixelRatio() - vp = (0, 0, int(self.width() * dpr), int(self.height() * dpr)) - glViewport(*vp) glEnable(GL_TEXTURE_2D) glBindTexture(GL_TEXTURE_2D, self.texture) glColor4f(1, 1, 1, 1)