Skip to content
Snippets Groups Projects
Commit a12ec8be authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Transparency works

parent a412f6c4
No related branches found
No related tags found
No related merge requests found
...@@ -249,6 +249,14 @@ class SliceCanvas(wxgl.GLCanvas): ...@@ -249,6 +249,14 @@ class SliceCanvas(wxgl.GLCanvas):
self.Bind(wx.EVT_PAINT, self.draw) self.Bind(wx.EVT_PAINT, self.draw)
def alphaChanged(newAlpha, *a):
self.Refresh()
self.image.addListener(
'alpha',
'SliceCanvasAlpha_{}'.format(id(self)),
alphaChanged)
def _initGLData(self): def _initGLData(self):
""" """
...@@ -415,6 +423,10 @@ class SliceCanvas(wxgl.GLCanvas): ...@@ -415,6 +423,10 @@ class SliceCanvas(wxgl.GLCanvas):
gl.glUseProgram(self.shaders) gl.glUseProgram(self.shaders)
# enable transparency
gl.glEnable(gl.GL_BLEND)
gl.glBlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA)
# Set up the colour buffer # Set up the colour buffer
gl.glEnable(gl.GL_TEXTURE_1D) gl.glEnable(gl.GL_TEXTURE_1D)
gl.glActiveTexture(gl.GL_TEXTURE0) gl.glActiveTexture(gl.GL_TEXTURE0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment