Back to MATLAB Programming/Psychtoolbox
% ptb_ind_screen_setup.m
%
% This script is used to set up the psychtoolbox screen function in a
% universal way to allow the same program to be run on windows, OS X,
% and classic mac.
%
% Revision History:
% RobKohr - April 7, 2005 - First draft
% If there are multiple displays guess that one without the menu bar is the
% best choice. Dislay 0 has the menu bar.
screens=Screen('Screens');
%if screenNumber is set prior to running this
%we will keep that value
if not(exist('screenNumber','var'))
screenNumber=max(screens);
end
v = version;
v = str2num(v(1));
osx = 0;
oldmac = 0;
win = 0;
if(strcmp(computer, 'MAC')|strcmp(computer, 'MAC2'))
if(v<6) %classic mode
comp_type = 'oldmac';
oldmac=1;
else
comp_type = 'osx';
osx =1;
end
else
comp_type = 'win';
win=1;
end
if(oldmac|win)
[window_ptr, window_rect]= Screen(screenNumber, 'OpenWindow', [0, 0, 0]);
window = Screen(window_ptr, 'OpenOffscreenWindow', [0,0,0], window_rect);
blank = Screen(window_ptr, 'OpenOffscreenWindow', [0,0,0], window_rect);
else
[window, window_rect]= Screen(screenNumber,'OpenWindow', 0, [], 32, 2);
end