useFBO seems to lead to confusing behaviour with multiple windows?

319 views
Skip to first unread message

Anneke Haddad

unread,
Jun 10, 2015, 12:17:05 PM6/10/15
to psychop...@googlegroups.com
Hello,

I've been trying to work out why my code for getting stimuli to appear in two windows wasn't working. I think I've narrowed the cause down to the 'useFBO' option, which seems to somehow mess up the behaviour of multiple windows...? Sorry for my non-technical/non-specific description of the problem - perhaps it's easier to show you what I mean. I expected that the code below would display msg1 in win1 and msg2 in win2. Instead, the background of win2 changes colour to match win1 (which is very odd!) and msg1 appears in win2 (and nothing appears in win1). It's as if win1 is being ignored and win2 is behaving like win1 ought to.

Switching useFBO to False for both win1 and win2 gives the behaviour that I expected. 

I therefore think I want to switch useFBO to False - under what circumstances might this cause me problems? (The only reason it was set to True in my experiment was that I had compiled the code from the Builder view.)

Thanks,
Anneke


# Import key parts of the PsychoPy library:
from psychopy import visual, core

# Create 2 visual windows:
win1 = visual.Window([800,1000], pos=(40,40), color=(0,0,0), fullscr=False, screen=0, monitor='Monitor1', colorSpace='rgb', useFBO=True, waitBlanking=False)
win2 = visual.Window([800,1000], pos=(1000,40), color=(1,0,0), fullscr=False, screen=0, monitor='Monitor1', colorSpace='rgb', useFBO=True, waitBlanking=False)
    
# Create (but not yet display) some text:
msg1 = visual.TextStim(win1, text=u"Hello world!")  # default position = centered
msg2 = visual.TextStim(win2, text=u"\u00A1Hola mundo!", pos=(0, -0.3))

# Draw the text to the hidden visual buffer:
msg1.draw()
msg2.draw()

# Show the hidden buffer--everything that has been drawn since the last win.flip():
win1.flip()
win2.flip()

# Wait 3 seconds so people can see the message, then exit gracefully:
core.wait(3)
win1.close()
win2.close()

Jonathan Peirce

unread,
Jun 11, 2015, 5:00:25 AM6/11/15
to psychop...@googlegroups.com
There have also been reports recently that useFBO=True was causing frame drops on some machines (and I wonder if this is why some peple have reported that avbin movies are more jerky in recent versions of PsychoPy). As a result I think we should move with the next release to useFBO=False by default and only turn it on where we expect it to be needed. What the useFBO does is render your window to an 'offscreen' window first before drawing that to the 'back buffer' and that process allows us to do some fancy transforms on the whole window when we then flip().

For many users it won't be necessary (e.g. for standard cognitive and social psychology studies). We do need it for:
    - 'adding' rather than averaging stimuli that are drawn (e.g. to add a red and green image for different eye in anaglyph glasses). Averaging partially obscures the stimulus behind which isn't always the desired outcome
    - high dynamic range devices like Cambridge Research Systems Bits#
    - warping of the window image to account for different projection screens

So, in short, useFBO can probably be safely turned off in your case,and will be off by default in future versions. I'll also try to fix it so that people *can* use it with dual windows as well though, so thanks for your report.

best wishes
Jon
--
You received this message because you are subscribed to the Google Groups "psychopy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psychopy-user...@googlegroups.com.
To post to this group, send email to psychop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psychopy-users/2917700c-89fd-4470-94bd-b9e92036cc7e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Jonathan Peirce
University of Nottingham

http://www.peirce.org.uk


This message and any attachment are intended solely for the addressee
and may contain confidential information. If you have received this
message in error, please send it back to me, and immediately delete it. 

Please do not use, copy or disclose the information contained in this
message or in any attachment.  Any views or opinions expressed by the
author of this email do not necessarily reflect the views of the
University of Nottingham.

This message has been checked for viruses but the contents of an
attachment may still contain software viruses which could damage your
computer system, you are advised to perform your own checks. Email
communications with the University of Nottingham may be monitored as
permitted by UK legislation.

Armando Angulo

unread,
Sep 9, 2016, 3:51:24 AM9/9/16
to psychopy-users
El cambio del color es porque en win2 el parámetro color = (1,0,0), es decir, naranja, mientras que en win 1 color = (0,0,0), es decir, gris. 

El error en el mensaje se debe a que tanto en win1 como win2 screen = 0, debes poner en win1=....screen= 0 y win2=...screen = 1, el número equivale a la pantalla que van de 0 a 9, identifica el número de pantalla a donde quieres enviar tu mensaje. Esto también causa que msg2 se presente en win1.
 
El error de posicion es porque en win2 el parámetro POS = (1000, 40), entonces debes cambiar esos parametros a la posicion que tu quieras que aparezca, por ejemplo POS= (0,0) tanto en win2 como en win1.

Se puede intentar esto:

# Import key parts of the PsychoPy library:
from psychopy import visual, core


# Create 2 visual windows:
win1 = visual.Window([800,1000], pos=(0,0), color=(0,0,0), fullscr=False, screen=0, monitor='Monitor2', colorSpace='rgb', useFBO=False, waitBlanking=False)
win2 = visual.Window([800,1000], pos=(0,0), color=(0,0,0), fullscr=False, screen=1, monitor='Monitor2', colorSpace='rgb', useFBO=False, waitBlanking=False)
Reply all
Reply to author
Forward
0 new messages