summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Munaut2013-01-15 05:51:53 -0800
committerJohnathan Corgan2013-01-15 05:51:53 -0800
commitc33c33c5d8a0286ce058a0f1a0400d9072eeb27e (patch)
tree79a5cfa1757df5624b46ceeb9a9c68768f5ca86f
parente41dbf2d970bc372474cf82159710e418d1f346d (diff)
downloadgnuradio-c33c33c5d8a0286ce058a0f1a0400d9072eeb27e.tar.gz
gnuradio-c33c33c5d8a0286ce058a0f1a0400d9072eeb27e.tar.bz2
gnuradio-c33c33c5d8a0286ce058a0f1a0400d9072eeb27e.zip
wxgui: implement persistence without using glAccum
-rw-r--r--gr-wxgui/src/python/plotter/plotter_base.py35
1 files changed, 19 insertions, 16 deletions
diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py
index 41c94e5e0..25811f09b 100644
--- a/gr-wxgui/src/python/plotter/plotter_base.py
+++ b/gr-wxgui/src/python/plotter/plotter_base.py
@@ -172,26 +172,29 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
for cache in self._gl_caches: cache.changed(True)
self._resized_flag = False
- # clear buffer
- GL.glClear(GL.GL_COLOR_BUFFER_BIT)
+ # clear buffer if needed
+ if self.clear_accum or not self.use_persistence:
+ GL.glClear(GL.GL_COLOR_BUFFER_BIT)
+ self.clear_accum=False
+
+ # apply fading
+ if self.use_persistence:
+ GL.glEnable(GL.GL_BLEND)
+ GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA)
+
+ GL.glBegin(GL.GL_QUADS)
+ GL.glColor4f(1,1,1,self.persist_alpha)
+ GL.glVertex2f(0, self.height)
+ GL.glVertex2f(self.width, self.height)
+ GL.glVertex2f(self.width, 0)
+ GL.glVertex2f(0, 0)
+ GL.glEnd()
+
+ GL.glDisable(GL.GL_BLEND)
# draw functions
for fcn in self._draw_fcns: fcn[1]()
- # apply persistence
- if self.use_persistence:
- if self.clear_accum:
- #GL.glClear(GL.GL_ACCUM_BUFFER_BIT)
- try:
- GL.glAccum(GL.GL_LOAD, 1.0)
- except:
- pass
- self.clear_accum=False
-
- GL.glAccum(GL.GL_MULT, 1.0-self.persist_alpha)
- GL.glAccum(GL.GL_ACCUM, self.persist_alpha)
- GL.glAccum(GL.GL_RETURN, 1.0)
-
# show result
self.SwapBuffers()
self.unlock()