Displaying images (or other graphical context) with the PsychToolbox usually involves the handling of "invisible" screens. When showing stimuli to the subjects you want to do it as quickly and as accurately as possible. The major limition will be the refresh rate of your monitor, but some care must be taken not to introduce further software delays. The easiest solution is to create or load all your stimuli or instruction screen into the graphic card (or in a special format in the main memory) before you start the actual experiment. When you want to display your stimulus in the experiment you then just have to copy the appropriate (hidden) screen to the (visible) main screen. With modern computers that have a fast data transfer (bus) systems this will be accomplished within nanoseconds.
% Open a window in center of screen
screenNumber=0;
rect=CenterRect([0 0 200 200],Screen(screenNumber,'Rect'));
window=Screen(screenNumber,'OpenWindow',[],rect);
w(i)=Screen(window,'OpenOffscreenWindow');
% [...] Draw your stuff
rect=Screen(w,'Rect');
% Wait for blanking, then display offscreen
Screen(window,'WaitBlanking');
Screen('CopyWindow',w,window,rect,rect);
% Wait for key press
% Close the on- and off-screen windows
Page Execution took 6.137 seconds |