Skip to content

Commit

Permalink
BF: adding a potential fix to the pyglet shadow_window issue
Browse files Browse the repository at this point in the history
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 a1c29d3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion psychojs
29 changes: 23 additions & 6 deletions psychopy/visual/window.py
Expand Up @@ -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
Expand Down

0 comments on commit a1c29d3

Please sign in to comment.