diff options
Diffstat (limited to 'gr-wxgui/src/python/plotter/plotter_base.py')
-rw-r--r-- | gr-wxgui/src/python/plotter/plotter_base.py | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/gr-wxgui/src/python/plotter/plotter_base.py b/gr-wxgui/src/python/plotter/plotter_base.py index dede5a0ad..b856215e9 100644 --- a/gr-wxgui/src/python/plotter/plotter_base.py +++ b/gr-wxgui/src/python/plotter/plotter_base.py @@ -1,5 +1,5 @@ # -# Copyright 2008, 2009 Free Software Foundation, Inc. +# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. # # This file is part of GNU Radio # @@ -87,7 +87,10 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): @param parent the parent widgit """ attribList = (wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_RGBA) - wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList) + wx.glcanvas.GLCanvas.__init__(self, parent, attribList=attribList); + self.use_persistence=False + self.persist_alpha=2.0/15 + self.clear_accum=True self._gl_init_flag = False self._resized_flag = True self._init_fcns = list() @@ -97,6 +100,13 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): self.Bind(wx.EVT_SIZE, self._on_size) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda e: None) + def set_use_persistence(self,enable): + self.use_persistence=enable + self.clear_accum=True + + def set_persist_alpha(self,analog_alpha): + self.persist_alpha=analog_alpha + def new_gl_cache(self, draw_fcn, draw_pri=50): """ Create a new gl cache. @@ -131,6 +141,7 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): """ self.lock() self._resized_flag = True + self.clear_accum=True self.unlock() def _on_paint(self, event): @@ -160,7 +171,30 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex): self._resized_flag = False #clear, draw functions, swap GL.glClear(GL.GL_COLOR_BUFFER_BIT) + + if False: + GL.glEnable (GL.GL_LINE_SMOOTH) + GL.glEnable (GL.GL_POLYGON_SMOOTH) + GL.glEnable (GL.GL_BLEND) + GL.glBlendFunc (GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) + GL.glHint (GL.GL_LINE_SMOOTH_HINT, GL.GL_NICEST) #GL.GL_DONT_CARE) + GL.glHint(GL.GL_POLYGON_SMOOTH_HINT, GL.GL_NICEST) + #GL.glLineWidth (1.5) + + GL.glEnable(GL.GL_MULTISAMPLE) #Enable Multisampling anti-aliasing + + for fcn in self._draw_fcns: fcn[1]() + + if self.use_persistence: + if self.clear_accum: + #GL.glClear(GL.GL_ACCUM_BUFFER_BIT) + GL.glAccum(GL.GL_LOAD, 1.0) + 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) self.SwapBuffers() self.unlock() |