Skip to content

Commit 99d0977

Browse files
committed
add aperture texture
1 parent 1e1b6be commit 99d0977

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

apertureTexture.m

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
2+
function cfg = apertureTexture(action, cfg, thisEvent)
3+
4+
matrixSize = 400;
5+
6+
switch action
7+
8+
case 'init'
9+
10+
cfg.aperture.texture = Screen('MakeTexture', cfg.screen.win, ...
11+
cfg.color.background(1) * ones(cfg.screen.winRect([4 3])));
12+
13+
case 'make'
14+
15+
switch cfg.aperture.type
16+
17+
case 'none'
18+
19+
Screen('Fillrect', cfg.aperture.texture, [0 0 0 0]);
20+
21+
case 'circle'
22+
23+
Screen('FillOval', cfg.aperture.texture, [0 0 0 0], ...
24+
CenterRectOnPoint([0 0 repmat(matrixSize, 1, 2)], ...
25+
cfg.screen.winRect(3) / 2, cfg.screen.winRect(4) / 2));
26+
27+
end
28+
29+
case 'draw'
30+
31+
Screen('DrawTexture', cfg.screen.win, cfg.aperture.texture);
32+
33+
% Screen('DrawTexture', cfg.screen.win, apertureTexture, ...
34+
% cfg.screen.winRect, cfg.screen.winRect, current.apertureAngle - 90);
35+
36+
37+
end
38+
39+
40+
41+
42+
43+
44+
end

setDefaultsPTB.m

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
fieldsToSet.fixation.width = 1;
3939
fieldsToSet.fixation.lineWidthPix = 5;
4040

41+
% define visual apperture field
42+
fieldsToSet.aperture.type = 'none';
43+
4144
if isfield(cfg, 'audio') && cfg.audio.do
4245

4346
fieldsToSet.audio.fs = 44800;

0 commit comments

Comments
 (0)