/usr/share/psychtoolbox-3/PsychDemos/ECVP2013/HelloSpiralTextureDemo.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | % SpiralTextureDemo
% Written by Peter Scarfe.
PsychDefaultSetup(2);
% Get the screen numbers
screens = Screen('Screens');
% Draw to the external screen if avaliable
screenNumber = max(screens);
% Define grey and white
white = WhiteIndex(screenNumber);
grey = GrayIndex(screenNumber);
inc = white - grey;
% Open an on screen window
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, grey);
% Get the size of the on screen window
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
% Get the centre coordinate of the window
[xCenter, yCenter] = RectCenter(windowRect);
% Set up alpha-blending for smooth (anti-aliased) lines
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
% Define a simple spiral texture by defining X and Y coordinates with the
% meshgrid command, converting these to polar coordinates and finally
% defining the spiral texture
[x, y] = meshgrid(-120:1:120, -120:1:120);
[th, r] = cart2pol(x, y);
spiral = grey + inc .* cos(r / 5 + th * 5);
% Make our spiral texure into a screen texture for drawing
spiralTexture = Screen('MakeTexture', window, spiral)
% We are going to draw four textures to show how a black and white texture
% can be color modulated upon drawing.
yPos = yCenter;
xPos = linspace(screenXpixels * 0.2, screenXpixels * 0.8, 4);
% Define the destination rectangles for our spiral textures. For this demo
% these will be the same size as our actual texture, but this doesn't have
% to be the case. See: ScaleSpiralTextureDemo and CheckerboardTextureDemo.
[s1, s2] = size(x);
baseRect = [0 0 s1 s2];
dstRects = nan(4, 4);
for i = 1:4
dstRects(:, i) = CenterRectOnPointd(baseRect, xPos(i), yPos);
end
% Color Modulation
colorMod = [1 1 1; 1 0 0; 0 1 0; 0 0 1]';
% Batch Draw all of the texures to screen
Screen('DrawTextures', window, spiralTexture, [], dstRects, [], [], [], colorMod);
% Flip to the screen
Screen('Flip', window);
% Wait for a key press
KbStrokeWait;
% Clear the screen
sca;
|