From a1064345d3c03ed8755cc84a60663dbdc4e68478 Mon Sep 17 00:00:00 2001 From: Kenneth Lyons Date: Sat, 6 Feb 2021 15:31:54 -0800 Subject: [PATCH] Disable paint in GLScatterPlotItem if it has no data --- pyqtgraph/opengl/items/GLScatterPlotItem.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pyqtgraph/opengl/items/GLScatterPlotItem.py b/pyqtgraph/opengl/items/GLScatterPlotItem.py index 463ad742..5d81515b 100644 --- a/pyqtgraph/opengl/items/GLScatterPlotItem.py +++ b/pyqtgraph/opengl/items/GLScatterPlotItem.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- from OpenGL.GL import * from OpenGL.arrays import vbo from .. GLGraphicsItem import GLGraphicsItem @@ -14,7 +15,7 @@ class GLScatterPlotItem(GLGraphicsItem): GLGraphicsItem.__init__(self) glopts = kwds.pop('glOptions', 'additive') self.setGLOptions(glopts) - self.pos = [] + self.pos = None self.size = 10 self.color = [1.0,1.0,1.0,0.5] self.pxMode = True @@ -99,6 +100,9 @@ class GLScatterPlotItem(GLGraphicsItem): ##glPointParameterfv(GL_POINT_SIZE_MIN, (0,)) def paint(self): + if self.pos is None: + return + self.setupGLState() glEnable(GL_POINT_SPRITE)