From c33c33c5d8a0286ce058a0f1a0400d9072eeb27e Mon Sep 17 00:00:00 2001 From: Sylvain Munaut Date: Tue, 15 Jan 2013 05:51:53 -0800 Subject: wxgui: implement persistence without using glAccum --- gr-wxgui/src/python/plotter/plotter_base.py | 35 ++++++++++++++++------------- 1 file 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() -- cgit