From 8deb576cf205764b674a231a99b7f0e8b38cd9ed Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauld.mccarthy@gmail.com> Date: Wed, 23 Mar 2016 15:07:40 +0000 Subject: [PATCH] Well. I decided that a multi-context setup was causing too many problems in a normal (non-VM) rendering envirnoment. So it is now only enabled for Apple/Software renderer environments. --- fsl/fsleyes/gl/__init__.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/fsl/fsleyes/gl/__init__.py b/fsl/fsleyes/gl/__init__.py index 3eb4ab3f1..323da23af 100644 --- a/fsl/fsleyes/gl/__init__.py +++ b/fsl/fsleyes/gl/__init__.py @@ -190,6 +190,7 @@ package also contains the following: import logging import os +import platform import fsl.utils.platform as fslplatform @@ -617,7 +618,7 @@ class WXGLCanvasTarget(object): def __init__(self): - """Create a ``WXGLCanasTarget``. + """Create a ``WXGLCanvasTarget``. Binds :attr:`wx.EVT_PAINT` events to the :meth:`_mainDraw` method. """ @@ -627,7 +628,23 @@ class WXGLCanvasTarget(object): self._glReady = False - self.__context = wxgl.GLContext(self, other=getWXGLContext()[0]) + context = getWXGLContext()[0] + + # If we are on OSX, and using the Apple Software + # Renderer (e.g. in a virtual machine), then it + # seems that we have to have a separate context + # for each display. If we don't, then strange + # refresh problems will occur. + if platform.system() == 'Darwin' and \ + 'software' in fslplatform.glRenderer.lower(): + + log.debug('Creating separate GL context for ' + 'WXGLCanvasTarget {}'.format(id(self))) + + context = wxgl.GLContext(self, other=context) + + self.__context = context + self.Bind(wx.EVT_PAINT, self._mainDraw) -- GitLab