Skip to content

Instantly share code, notes, and snippets.

@iandol
Last active October 11, 2018 09:26
Show Gist options
  • Save iandol/f100b50fd5e8b754deeb4618a320543b to your computer and use it in GitHub Desktop.
Save iandol/f100b50fd5e8b754deeb4618a320543b to your computer and use it in GitHub Desktop.
Screen('Preference', 'SkipSyncTests', 2)
PsychDefaultSetup(2);
screenId = max(Screen('Screens')); % get screen ID
PsychImaging('PrepareConfiguration');
PsychImaging('AddTask', 'General', 'UseFastOffscreenWindows');
PsychImaging('AddTask', 'General', 'FloatingPoint32Bit');
window = PsychImaging('OpenWindow',screenId,0.5); % open screen with background luminance 0.5
%Screen('BlendFunction', window, 'GL_ONE', 'GL_ZERO');
tex = Screen('MakeTexture',window,0.5); % create a texture with luminance 0.5
rect = [0,0,500,500]; % define texture rect as upper left 500x500 pixels of screen
for x = 1:20
if mod(x,2)
Screen('FrameRect', window, [1 1 1], [501 501 506 506]);
Screen('Flip',window); % flip
else
Screen('FrameRect', window, [1 1 0], [501 501 506 506]);
Screen('DrawTexture',window,tex,[],rect); % draw
Screen('Flip',window); % flip
end
WaitSecs(1);
end
sca %close screen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment