-
Notifications
You must be signed in to change notification settings - Fork 1
/
slm_psychtoolbox_control.m
68 lines (47 loc) · 1.13 KB
/
slm_psychtoolbox_control.m
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
Screen('Preference', 'SkipSyncTests', 1);
window = Screen('OpenWindow',1);
white = WhiteIndex(window);
black = BlackIndex(window);
%%
Screen(window, 'FillRect',0)
Screen(window,'Flip');
twoPi = 127;
%%
resX = 800;
resY = 600;
[x,y] = meshgrid(0:resX-1, 0:resY-1);
pixPeriod = 10;
image = ((mod(x+y,pixPeriod))>=pixPeriod/2) * twoPi;
Screen(window, 'PutImage',image);
Screen(window,'Flip');
%%
resX = 800;
resY = 600;
[x,y] = meshgrid(0:resX-1, 0:resY-1);
rampRate = 40;
image = mod(x*rampRate,twoPi);
Screen(window, 'PutImage',image);
Screen(window,'Flip');
%%
for i = 1:30
image = sin(0.01*2*pi*(x+i/30*100));
texture(i) = Screen(window, 'MakeTexture', image);
end
%%
for i = 1:30
Screen('DrawTexture', window, texture(i));
Screen(window,'Flip');
pause(1)
end
%%
twoPi = 125;
I = slm_hologram_code(124, [600 800],'tenss2.png');
Screen(window, 'PutImage',mod(I, twoPi));
Screen(window,'Flip');
%%
dist = sqrt((x-400).^2 + (y-300).^2);
power = .1;
fresnelLens = dist.^2 * power;
fresnelLens = uint8(mod(dist.^2 * power, twoPi));
Screen(window, 'PutImage',mod(I + fresnelLens, twoPi));
Screen(window,'Flip');