Merge pull request #648 from VanessaNav/fix-color-GLGridItem
fix color ignored in GLGridItem. Issue #283 solved
This commit is contained in:
commit
980fffbd31
@ -13,7 +13,7 @@ class GLGridItem(GLGraphicsItem):
|
|||||||
Displays a wire-frame grid.
|
Displays a wire-frame grid.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, size=None, color=None, antialias=True, glOptions='translucent'):
|
def __init__(self, size=None, color=(1, 1, 1, .3), antialias=True, glOptions='translucent'):
|
||||||
GLGraphicsItem.__init__(self)
|
GLGraphicsItem.__init__(self)
|
||||||
self.setGLOptions(glOptions)
|
self.setGLOptions(glOptions)
|
||||||
self.antialias = antialias
|
self.antialias = antialias
|
||||||
@ -21,6 +21,7 @@ class GLGridItem(GLGraphicsItem):
|
|||||||
size = QtGui.QVector3D(20,20,1)
|
size = QtGui.QVector3D(20,20,1)
|
||||||
self.setSize(size=size)
|
self.setSize(size=size)
|
||||||
self.setSpacing(1, 1, 1)
|
self.setSpacing(1, 1, 1)
|
||||||
|
self.color = color
|
||||||
|
|
||||||
def setSize(self, x=None, y=None, z=None, size=None):
|
def setSize(self, x=None, y=None, z=None, size=None):
|
||||||
"""
|
"""
|
||||||
@ -67,7 +68,7 @@ class GLGridItem(GLGraphicsItem):
|
|||||||
xs,ys,zs = self.spacing()
|
xs,ys,zs = self.spacing()
|
||||||
xvals = np.arange(-x/2., x/2. + xs*0.001, xs)
|
xvals = np.arange(-x/2., x/2. + xs*0.001, xs)
|
||||||
yvals = np.arange(-y/2., y/2. + ys*0.001, ys)
|
yvals = np.arange(-y/2., y/2. + ys*0.001, ys)
|
||||||
glColor4f(1, 1, 1, .3)
|
glColor4f(*self.color)
|
||||||
for x in xvals:
|
for x in xvals:
|
||||||
glVertex3f(x, yvals[0], 0)
|
glVertex3f(x, yvals[0], 0)
|
||||||
glVertex3f(x, yvals[-1], 0)
|
glVertex3f(x, yvals[-1], 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user