Merge pull request #1583 from pijyoi/port_qopenglwidget

RawImageWidget.py : fix port to QOpenGLWidget
This commit is contained in:
Ogi Moore 2021-02-15 21:02:34 -08:00 committed by GitHub
commit acd172eb13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,6 +134,8 @@ if HAVE_OPENGL:
glDisable(GL_TEXTURE_2D) glDisable(GL_TEXTURE_2D)
def paintGL(self): def paintGL(self):
glClear(GL_COLOR_BUFFER_BIT)
if self.image is None: if self.image is None:
if self.opts is None: if self.opts is None:
return return
@ -144,9 +146,6 @@ if HAVE_OPENGL:
if not self.uploaded: if not self.uploaded:
self.uploadTexture() self.uploadTexture()
dpr = self.devicePixelRatio()
vp = (0, 0, int(self.width() * dpr), int(self.height() * dpr))
glViewport(*vp)
glEnable(GL_TEXTURE_2D) glEnable(GL_TEXTURE_2D)
glBindTexture(GL_TEXTURE_2D, self.texture) glBindTexture(GL_TEXTURE_2D, self.texture)
glColor4f(1, 1, 1, 1) glColor4f(1, 1, 1, 1)