Skip to content

Commit

Permalink
Revert "fix GLImageItem"
Browse files Browse the repository at this point in the history
This reverts commit 36b2e49.
  • Loading branch information
pijyoi committed Mar 17, 2022
1 parent 088b488 commit 7dce519
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions pyqtgraph/opengl/items/GLImageItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ def _updateTexture(self):
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)
#glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_BORDER)
h, w = self.data.shape[:2]
shape = self.data.shape

## Test texture dimensions first
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, None)
glTexImage2D(GL_PROXY_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, None)
if glGetTexLevelParameteriv(GL_PROXY_TEXTURE_2D, 0, GL_TEXTURE_WIDTH) == 0:
raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % (h, w))
raise Exception("OpenGL failed to create 2D texture (%dx%d); too large for this hardware." % shape[:2])

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, self.data)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shape[0], shape[1], 0, GL_RGBA, GL_UNSIGNED_BYTE, self.data.transpose((1,0,2)))
glDisable(GL_TEXTURE_2D)

#self.lists = {}
Expand Down Expand Up @@ -87,16 +87,15 @@ def paint(self):
#glEnable( GL_ALPHA_TEST )
glColor4f(1,1,1,1)

h, w = self.data.shape[:2]
glBegin(GL_QUADS)
glTexCoord2f(1, 0)
glVertex3f(0, 0, 0)
glTexCoord2f(1, 1)
glVertex3f(h, 0, 0)
glTexCoord2f(0, 1)
glVertex3f(h, w, 0)
glTexCoord2f(0, 0)
glVertex3f(0, w, 0)
glTexCoord2f(0,0)
glVertex3f(0,0,0)
glTexCoord2f(1,0)
glVertex3f(self.data.shape[0], 0, 0)
glTexCoord2f(1,1)
glVertex3f(self.data.shape[0], self.data.shape[1], 0)
glTexCoord2f(0,1)
glVertex3f(0, self.data.shape[1], 0)
glEnd()
glDisable(GL_TEXTURE_2D)

0 comments on commit 7dce519

Please sign in to comment.