sca;
close all;
clear;
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
grey = white / 2;
inc = white - grey;
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
ifi = Screen('GetFlipInterval', window);
[xCenter, yCenter] = RectCenter(windowRect);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
[x, y] = meshgrid(-150:1:150, -150:1:150);
[th, r] = cart2pol(x, y);
spiral = grey + inc .* cos(r / 5 + th * 5);
spiralTexture = Screen('MakeTexture', window, spiral);
[s1, s2] = size(x);
baseRect = [0 0 s1 s2];
dstRects = nan(4, 3);
dstRects(:, 1) = CenterRectOnPointd(baseRect .* 0.5,...
screenXpixels * 0.2, yCenter);
dstRects(:, 2) = CenterRectOnPointd(baseRect,...
screenXpixels * 0.5, yCenter);
dstRects(:, 3) = CenterRectOnPointd(baseRect .* 1.25,...
screenXpixels * 0.8, yCenter);
Screen('DrawTextures', window, spiralTexture, [], dstRects);
Screen('Flip', window);
KbStrokeWait;
sca;