Permalink
Browse files

BF: Change window switching logic to also bind the FBO if enabled.

  • Loading branch information...
mdcutone authored and peircej committed May 12, 2017
1 parent c1ff68f commit 5e1c045ca0e7ead3a133a5cd192a49af9fbf7fa4
Showing with 18 additions and 3 deletions.
  1. +1 −3 psychopy/visual/basevisual.py
  2. +17 −0 psychopy/visual/window.py
@@ -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
@@ -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.

0 comments on commit 5e1c045

Please sign in to comment.