Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
BF: Change window switching logic to also bind the FBO if enabled.
  • Loading branch information
mdc authored and peircej committed Jun 15, 2017
1 parent c1ff68f commit 5e1c045
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 1 addition & 3 deletions psychopy/visual/basevisual.py
Expand Up @@ -1151,9 +1151,7 @@ def draw(self):

def _selectWindow(self, win):
# don't call switch if it's already the curr window
if win != globalVars.currWindow and win.winType == 'pyglet':
win.winHandle.switch_to()
globalVars.currWindow = win
self.win._setCurrent()

def _updateList(self):
"""The user shouldn't need this method since it gets called
Expand Down
17 changes: 17 additions & 0 deletions psychopy/visual/window.py
Expand Up @@ -548,6 +548,23 @@ def saveFrameIntervals(self, fileName=None, clear=True):
self.frameIntervals = []
self.frameClock.reset()

def _setCurrent(self):
"""Make this window current.
"""
if self != globalVars.currWindow and self.winType == 'pyglet':
self.winHandle.switch_to()
globalVars.currWindow = win

# if we are using an FBO, bind it
if self.useFBO:
GL.glBindFramebufferEXT(GL.GL_FRAMEBUFFER_EXT,
self.frameBuffer)
GL.glReadBuffer(GL.GL_COLOR_ATTACHMENT0_EXT)
GL.glDrawBuffer(GL.GL_COLOR_ATTACHMENT0_EXT)
GL.glActiveTexture(GL.GL_TEXTURE0)
GL.glBindTexture(GL.GL_TEXTURE_2D, 0)
GL.glEnable(GL.GL_STENCIL_TEST)

def onResize(self, width, height):
"""A default resize event handler.
Expand Down

0 comments on commit 5e1c045

Please sign in to comment.