But the simulation only exists within some arbitrarily shaped boundary, specified in a 2 dimensional numpy array. I want to be able to draw this boundary over the top of the simulation and this requires transparency, but I can't get it working, I just end up with the colours of the boundary layer on my screen. This is the pertinent code:
figure = glumpy.figure((m * scaleFactor, n * scaleFactor))
colourMapChemical = glumpy.colormap.Colormap("orange",
(0.00, (1.0, 0.6, 0.2)),
(1.00, (1.0, 1.0, 1.0)))
image = glumpy.image.Image(v, interpolation = 'nearest', colormap = colourMapChemical)
colourMapBoundaries = glumpy.colormap.Colormap("Boundries",
(0.00, (1.0, 0.1, 0.0, 1.0)),
(1.00, (1.0, 0.0, 1.0, 0.0)))
image2= glumpy.image.Image(areaInSimulation, interpolation = 'nearest', colormap = colourMapBoundaries)
@figure.event
def on_draw():
figure.clear()
OpenGL.GL.glEnable( OpenGL.GL.GL_BLEND )
OpenGL.GL.glBlendFunc( OpenGL.GL.GL_SRC_ALPHA, OpenGL.GL.GL_ONE_MINUS_SRC_ALPHA )
#mage2.draw( x=0, y=0, z=1, width=figure.width, height=figure.height )
image.draw( x=0, y=0, z=0, width=figure.width, height=figure.height )
dt = 0.1
@figure.event
def on_idle(elapsed):
global u,v,U,V,Z,F,k, diffusionConstants
for i in range(10):
Lu = (K*U.ravel()).reshape(U.shape)
Lv = (K*V.ravel()).reshape(V.shape)
u += dt * (diffusionConstants[0]*Lu - Z + f *(1-U))
v += dt * (diffusionConstants[1]*Lv + Z - (f+k)*V )
U,V = u, v
Z = U*V*V
image2.update()
image.update()
figure.redraw()
glumpy.show()