Merge pull request #1554 from ixjlyons/glscatterplotitem-nodata

Disable paint in GLScatterPlotItem if it has no data
This commit is contained in:
Ogi Moore 2021-02-06 16:30:24 -08:00 committed by GitHub
commit d1bcbf8ec0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from OpenGL.GL import * from OpenGL.GL import *
from OpenGL.arrays import vbo from OpenGL.arrays import vbo
from .. GLGraphicsItem import GLGraphicsItem from .. GLGraphicsItem import GLGraphicsItem
@ -14,7 +15,7 @@ class GLScatterPlotItem(GLGraphicsItem):
GLGraphicsItem.__init__(self) GLGraphicsItem.__init__(self)
glopts = kwds.pop('glOptions', 'additive') glopts = kwds.pop('glOptions', 'additive')
self.setGLOptions(glopts) self.setGLOptions(glopts)
self.pos = [] self.pos = None
self.size = 10 self.size = 10
self.color = [1.0,1.0,1.0,0.5] self.color = [1.0,1.0,1.0,0.5]
self.pxMode = True self.pxMode = True
@ -99,6 +100,9 @@ class GLScatterPlotItem(GLGraphicsItem):
##glPointParameterfv(GL_POINT_SIZE_MIN, (0,)) ##glPointParameterfv(GL_POINT_SIZE_MIN, (0,))
def paint(self): def paint(self):
if self.pos is None:
return
self.setupGLState() self.setupGLState()
glEnable(GL_POINT_SPRITE) glEnable(GL_POINT_SPRITE)