Merge pull request #1019 from 2xB/fix-1018

Fix: GLScatterPlotItem and GLImageItem initializeGL only executed once
This commit is contained in:
Ogi Moore 2019-08-16 20:19:31 -07:00 committed by GitHub
commit eb7baa3855
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -29,8 +29,11 @@ class GLImageItem(GLGraphicsItem):
GLGraphicsItem.__init__(self) GLGraphicsItem.__init__(self)
self.setData(data) self.setData(data)
self.setGLOptions(glOptions) self.setGLOptions(glOptions)
self.texture = None
def initializeGL(self): def initializeGL(self):
if self.texture is not None:
return
glEnable(GL_TEXTURE_2D) glEnable(GL_TEXTURE_2D)
self.texture = glGenTextures(1) self.texture = glGenTextures(1)

View File

@ -20,6 +20,7 @@ class GLScatterPlotItem(GLGraphicsItem):
self.pxMode = True self.pxMode = True
#self.vbo = {} ## VBO does not appear to improve performance very much. #self.vbo = {} ## VBO does not appear to improve performance very much.
self.setData(**kwds) self.setData(**kwds)
self.shader = None
def setData(self, **kwds): def setData(self, **kwds):
""" """
@ -54,6 +55,8 @@ class GLScatterPlotItem(GLGraphicsItem):
self.update() self.update()
def initializeGL(self): def initializeGL(self):
if self.shader is not None:
return
## Generate texture for rendering points ## Generate texture for rendering points
w = 64 w = 64