PR 693: Fix color handling in GLLinePlotItem

Merge branch 'koltafrickenfer-develop' into develop
This commit is contained in:
Luke Campagnola 2018-05-31 10:39:27 -07:00
commit 70398f7098

View File

@ -3,6 +3,7 @@ from OpenGL.arrays import vbo
from .. GLGraphicsItem import GLGraphicsItem
from .. import shaders
from ... import QtGui
from ... import functions as fn
import numpy as np
__all__ = ['GLLinePlotItem']
@ -56,21 +57,6 @@ class GLLinePlotItem(GLGraphicsItem):
def initializeGL(self):
pass
#def setupGLState(self):
#"""Prepare OpenGL state for drawing. This function is called immediately before painting."""
##glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) ## requires z-sorting to render properly.
#glBlendFunc(GL_SRC_ALPHA, GL_ONE)
#glEnable( GL_BLEND )
#glEnable( GL_ALPHA_TEST )
#glDisable( GL_DEPTH_TEST )
##glEnable( GL_POINT_SMOOTH )
##glHint(GL_POINT_SMOOTH_HINT, GL_NICEST)
##glPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, (0, 0, -1e-3))
##glPointParameterfv(GL_POINT_SIZE_MAX, (65500,))
##glPointParameterfv(GL_POINT_SIZE_MIN, (0,))
def paint(self):
if self.pos is None:
return
@ -85,12 +71,11 @@ class GLLinePlotItem(GLGraphicsItem):
glEnableClientState(GL_COLOR_ARRAY)
glColorPointerf(self.color)
else:
if isinstance(self.color, QtGui.QColor):
if isinstance(self.color, (str, QtGui.QColor)):
glColor4f(*fn.glColor(self.color))
else:
glColor4f(*self.color)
glLineWidth(self.width)
#glPointSize(self.width)
if self.antialias:
glEnable(GL_LINE_SMOOTH)