Skip to content

Commit 26de68f

Browse files
committed
update from visual localizer to use textures
1 parent fbd03db commit 26de68f

File tree

5 files changed

+21
-19
lines changed

5 files changed

+21
-19
lines changed

apertureTexture.m

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
1-
21
function cfg = apertureTexture(action, cfg, thisEvent)
32

4-
matrixSize = 400;
3+
transparent = [0 0 0 0];
54

65
switch action
76

87
case 'init'
98

9+
% we take the screen height as maximum aperture width if not
10+
% specified.
11+
if ~isfield(cfg.aperture, 'width') || isempty(cfg.aperture.width)
12+
cfg.aperture.width = cfg.screen.winRect(4) / cfg.screen.ppd;
13+
end
14+
cfg.aperture = degToPix('width', cfg.aperture, cfg);
15+
1016
cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ...
1117
cfg.color.background(1) * ones(cfg.screen.winRect([4 3])));
1218

@@ -16,12 +22,14 @@
1622

1723
case 'none'
1824

19-
Screen('Fillrect', cfg.aperture.texture, [0 0 0 0]);
25+
Screen('Fillrect', cfg.aperture.texture, transparent);
2026

2127
case 'circle'
2228

23-
Screen('FillOval', cfg.aperture.texture, [0 0 0 0], ...
24-
CenterRectOnPoint([0 0 repmat(matrixSize, 1, 2)], ...
29+
diameter = cfg.aperture.widthPix;
30+
31+
Screen('FillOval', cfg.aperture.texture, transparent, ...
32+
CenterRectOnPoint([0 0 repmat(diameter, 1, 2)], ...
2533
cfg.screen.winRect(3) / 2, cfg.screen.winRect(4) / 2));
2634

2735
end
@@ -30,15 +38,9 @@
3038

3139
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture);
3240

33-
% Screen('DrawTexture', cfg.screen.win, apertureTexture, ...
34-
% cfg.screen.winRect, cfg.screen.winRect, current.apertureAngle - 90);
35-
36-
41+
% Screen('DrawTexture', cfg.screen.win, apertureTexture, ...
42+
% cfg.screen.winRect, cfg.screen.winRect, current.apertureAngle - 90);
43+
3744
end
38-
39-
40-
41-
42-
43-
45+
4446
end

degToPix.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
deg = getfield(structure, fieldName); %#ok<GFLD>
99

1010
structure = setfield(structure, [fieldName 'Pix'], ...
11-
floor(cfg.screen.ppd * deg)) ; %#ok<SFLD>
11+
floor(deg * cfg.screen.ppd)) ; %#ok<SFLD>
1212

1313
end

dotTexture.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
Screen('FillRect', cfg.dot.texture, cfg.color.background);
1212
Screen('DrawDots', cfg.dot.texture, ...
13-
thisEvent.dot.position, ...
13+
thisEvent.dot.positions, ...
1414
cfg.dot.sizePix, ...
1515
cfg.dot.color, ...
1616
cfg.screen.center, ...

getExperimentEnd.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
ExpmtDurMin = floor(ExpmtDur / 60);
99
ExpmtDurSec = mod(ExpmtDur, 60);
1010
disp(['Experiment lasted ', ...
11-
num2str(ExpmtDurMin), ' minutes', ...
11+
num2str(ExpmtDurMin), ' minutes ', ...
1212
num2str(ExpmtDurSec), ' seconds']);
1313
disp(' ');
1414

waitForTrigger.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function waitForTrigger(cfg, deviceNumber)
2727

2828
if strcmpi(cfg.testingDevice, 'mri')
2929

30-
msg = 'Waiting for trigger';
30+
msg = 'Waiting for trigger...';
3131
talkToMe(cfg, msg);
3232

3333
while triggerCounter < cfg.mri.triggerNb

0 commit comments

Comments
 (0)