# Working with two screens

**URL:** <https://psychtoolbox.discourse.group/t/working-with-two-screens/1348>\
**Category:** Uncategorized\
**Created:** [January 5, 2006, 8:47am UTC](https://psychtoolbox.discourse.group/t/working-with-two-screens/1348 "2006-01-05T08:47:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [January 5, 2006, 8:47am UTC](https://psychtoolbox.discourse.group/t/working-with-two-screens/1348/1 "2006-01-05T08:47:38Z")

</div>

I'd like to work with two screens, but Matlab is unable to recognize  
the second one. When I type:  
  
screen(1,'OpenWindow',0)  
  
I only get the message 'Invalid windowPtrOrScreenNumber'.  
I'm working with a GeForce FX5700 LE and two Iiyama Vision Master  
screens, one on the analogue connection, one on the digital, with an  
adapter in between. Using Matlab 7.0.4.365 (R14) SP2. Enlarging the  
desktop onto both screens doesnt make any difference.  
Thanks for helping!

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 5, 2006, 7:59pm UTC](https://psychtoolbox.discourse.group/t/working-with-two-screens/1348/2 "2006-01-05T19:59:04Z")

</div>

Hi,  
  
the OS-X Psychtoolbox and afaik the OS-9 Psychtoolbox  
do support simultaneous use of multiple displays,  
but according to  
\<[http://www.psychtoolbox.org/win.html#differences](http://www.psychtoolbox.org/win.html#differences)\>,  
the Windows Psychtoolbox doesn't support simultaneous  
use of multiple displays (if this information is still  
up to date).  
  
-mario  
  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "jesterdo" \<cord.westhoff@r...\>  
wrote:  

> \>  
> \> Might be interesting:  
> \>   
> \> [win, res]=screen(0,'OpenWindow',0,[],8);  
> \> waitsecs(1)  
> \> clear mex  
> \>   
> \> ...causes BOTH screens to go black...whereas...  
> \>   
> \> [win, res]=screen(0,'OpenWindow',0,[],16);  
> \> waitsecs(1)  
> \> clear mex  
> \>   
> \> ...(i.e., with a 16bit-window) only causes the FIRST screen to go black.  
> \>

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [January 12, 2006, 7:53pm UTC](https://psychtoolbox.discourse.group/t/working-with-two-screens/1348/3 "2006-01-12T19:53:56Z")

</div>

You didn't tell us which operating system/PTB you use.  
That's the most crucial info for any request as features  
differ between the different PTB's.  
  
WaitBlanking on OS9 or Win will wait for VBL onset on the  
display that the onscreen window belongs to. If both  
displays are running in sync with each other and you  
can paint your stim fast enough for both views you're done.  
In theory - in practice there may be limitations imposed  
by the specific device driver of your graphics hardware.  
  
OS-X PTB contains two different algorithms for synced  
multi-display flips, both untested. I don't have access to  
dual-display on OS-X and the person who requested this  
feature didn't give me any feedback if it works for him.  
In theory, each of them should be better than the  
old solutions, in practice nobody knows until tested...  
  
A simple visual test on old PTBs is to display an alternating  
black-white pattern in an endless loop...  
  
while(1)  
 Screen('WaitBlanking",....)  
 Screen('FillRect', ...., [255 255 255]);  
 Screen('WaitBlanking",....)  
 Screen('FillRect', ...., [0 0 0]);  
end;  
  
If you get homogenous black-white flicker, syncing is  
probably ok. If you get tearing on a display you'll know  
vbl sync is screwed. If you get a static horizontal "crack" on some  
line you'll have to place your stimulus properly to avoid trouble.  
  
-mario  
  
  
--- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "jesterdo" \<cord.westhoff@r...\>  
wrote:  

> \>  
> \> Thanks!  
> \> Now I'm working with a resolution of 2048x768, and another question  
> \> appeared: What about the vertical sync of the two screens? I.e., when  
> \> I use the 'WaitBlanking', are both screens cleared at the same time?  
> \> Or how can I be sure that stimuli on the screens appear at exactly the  
> \> same time?  
> \>   
> \>   
> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "Mario Kleiner"  
> \> \<mario.kleiner@t...\> wrote:  
> \> \>  
> \> \> Hi,  
> \> \>   
> \> \> the OS-X Psychtoolbox and afaik the OS-9 Psychtoolbox  
> \> \> do support simultaneous use of multiple displays,  
> \> \> but according to  
> \> \> \<[http://www.psychtoolbox.org/win.html#differences](http://www.psychtoolbox.org/win.html#differences)\>,  
> \> \> the Windows Psychtoolbox doesn't support simultaneous  
> \> \> use of multiple displays (if this information is still  
> \> \> up to date).  
> \> \>   
> \> \> -mario  
> \> \>   
> \> \>   
> \> \> --- In [psychtoolbox@yahoogroups.com](mailto:psychtoolbox@yahoogroups.com), "jesterdo" \<cord.westhoff@r...\>  
> \> \> wrote:  
> \> \> \>  
> \> \> \> Might be interesting:  
> \> \> \>   
> \> \> \> [win, res]=screen(0,'OpenWindow',0,[],8);  
> \> \> \> waitsecs(1)  
> \> \> \> clear mex  
> \> \> \>   
> \> \> \> ...causes BOTH screens to go black...whereas...  
> \> \> \>   
> \> \> \> [win, res]=screen(0,'OpenWindow',0,[],16);  
> \> \> \> waitsecs(1)  
> \> \> \> clear mex  
> \> \> \>   
> \> \> \> ...(i.e., with a 16bit-window) only causes the FIRST screen to go  
> \> black.  
> \> \> \>  
> \> \>  
> \>
