Hi,
i have been busy coding a fairly involved setup using psychopy 3.0.0b2 with python 2.7 in pycharm. So far it worked out fairly well overall. I encoutered a bug with text stimuli and decided to upgrade to psychopy 3.0.7 with python 3.7. the transition was mostly smooth but now i encounter some strange behavior when using multiple windows with different resolutions.
When both windows use the same resolution stimuli are displayed as inteded. Changing the resolution on one window seems to influence the second in that stimuli are not displayed at the correct location and scale. I was able to narrow the cause down to the .flip() command. If only one window is flipped, everything is fine. I suspect that it has something to do with buffering and that flipping one window overwrites some parameter in the other.
I can reproduce the described behaviour with this code:
I hope this illustrates the problem. It was not happening in 3.0.0b2 so something must have changed in the meantime.
I would be very happy if someone could help me with this.
Happy easter
I realized my problem description was not very clear. I updated the code to better illustrate the problem.
based on the code, you yould expect a simple square to be drawn on both windows. This happens only for the first frame, on subsequent frames the scaling is thrown off, causing the square to be streched and relocated on both screens.
I was able to fix this problem by overwriting the resetEyeTransform method of the window class. This method gets called in .flip() and caused mismatching defaults to be restored.
My solution in code:
# before creatig the windows:
class Window(visual.Window):
def resetEyeTransform(self, clearDepth=True):
pass
# then procede to use the new Window() class
win1 = Window(size=mainres)
That seems to be the same issue from what i can tell, the behavior is very similar.
I am on two windows machines, win7 and 10. I think the Issue is independent of platform.
In the .flip() method of the .window class the line:
seems to reset to defaults on every flip. When using multiple windows with unequal resolutions the default transformations do not fit the windows any more an the contents get distorted.
You could comment out the line above in the code to quickly test if this is also the cause of your issues.
These changes were introduced to allow the window class to handle different projections. It should be able to handle windows with different resolutions, however there seems to be something I missed. I’ll look into it and see if I can issue a patch.
Usually, I use matched displays all sharing the same attributes (i.e. size, color depth, etc.) to present multiple windows, so other cases slipped through when testing it out.
In the process of fixing this issue, I found and fixed some other problem behaviours when using multiple windows. I suspect there might be a few edge cases where things might behave weird, but I doubt most people will encounter those issues before I get to them.