Permalink
Browse files

BF: adding a potential fix to the pyglet shadow_window issue

Some graphics cards (or their drivers) don't support OpenGL
shadow windows, which pyglet uses to bind textures etc. Turning it off
should only affect people that need multiple windows, with stimuli
shared between them.
  • Loading branch information...
peircej committed Dec 8, 2017
1 parent ae283ce commit a1c29d3a7437b2b6a4977943cb5cb9242f34afed
Showing with 24 additions and 7 deletions.
  1. +1 −1 psychojs
  2. +23 −6 psychopy/visual/window.py
View
@@ -1469,12 +1469,29 @@ def _setupPyglet(self):
style = None
else:
style = 'borderless'
self.winHandle = pyglet.window.Window(width=w, height=h,
caption="PsychoPy",
fullscreen=self._isFullScr,
config=config,
screen=thisScreen,
style=style)
try:
self.winHandle = pyglet.window.Window(
width=w, height=h,
caption="PsychoPy",
fullscreen=self._isFullScr,
config=config,
screen=thisScreen,
style=style)
except pyglet.gl.ContextException:
# turn off the shadow window an try again
pyglet.options['shadow_window'] = False
self.winHandle = pyglet.window.Window(
width=w, height=h,
caption="PsychoPy",
fullscreen=self._isFullScr,
config=config,
screen=thisScreen,
style=style)
logging.warning("Pyglet shadow_window has been turned off. This is "
"only an issue for you if you need multiple "
"stimulus windows, in which case update your "
"graphics card and/or graphics drivers.")
if sys.platform == 'win32':
# pyHook window hwnd maps to:
# pyglet 1.14 -> window._hwnd

0 comments on commit a1c29d3

Please sign in to comment.