summaryrefslogtreecommitdiff
path: root/gr-wxgui/python/wxgui/plotter/plotter_base.py
diff options
context:
space:
mode:
authorJohnathan Corgan <johnathan@corganlabs.com>2013-06-22 10:04:28 -0700
committerJohnathan Corgan <johnathan@corganlabs.com>2013-06-22 10:04:28 -0700
commita00231d5fc7411c8bb3f0ffdf72f2ccabd2477b6 (patch)
treede07a61632c7e9f1f6df9da0df89623f810ae9b4 /gr-wxgui/python/wxgui/plotter/plotter_base.py
parent11fd3f467ab8a8c7e548dfed092d102945770f99 (diff)
parent48e5bff6fe99b5d4654fcb03a6f8da8a206eb7d7 (diff)
Merge branch 'maint'
Conflicts: gnuradio-core/src/lib/runtime/gr_tpb_thread_body.cc
Diffstat (limited to 'gr-wxgui/python/wxgui/plotter/plotter_base.py')
-rw-r--r--gr-wxgui/python/wxgui/plotter/plotter_base.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/gr-wxgui/python/wxgui/plotter/plotter_base.py b/gr-wxgui/python/wxgui/plotter/plotter_base.py
index 78e21f3c1d..ca904908ec 100644
--- a/gr-wxgui/python/wxgui/plotter/plotter_base.py
+++ b/gr-wxgui/python/wxgui/plotter/plotter_base.py
@@ -91,7 +91,8 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
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, wx.ID_ANY, attribList=attribList); # Specifically use the CTOR which does NOT create an implicit GL context
+ self._gl_ctx = wx.glcanvas.GLContext(self) # Create the explicit GL context
self.use_persistence=False
self.persist_alpha=2.0/15
self.clear_accum=True
@@ -157,10 +158,14 @@ class plotter_base(wx.glcanvas.GLCanvas, common.mutex):
Resize the view port if the width or height changed.
Redraw the screen, calling the draw functions.
"""
+ if not self.IsShownOnScreen(): # Cannot realise a GL context on OS X if window is not yet shown
+ return
# create device context (needed on Windows, noop on X)
- dc = wx.PaintDC(self)
+ dc = None
+ if event.GetEventObject(): # Only create DC if paint triggered by WM message (for OS X)
+ dc = wx.PaintDC(self)
self.lock()
- self.SetCurrent()
+ self.SetCurrent(self._gl_ctx) # Real the explicit GL context
# check if gl was initialized
if not self._gl_init_flag: