Skip to content

Commit 3a7d796

Browse files
committed
remove dead code and change Tex to Texture
1 parent a751603 commit 3a7d796

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

devSandbox.m

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141

4242
% Define black and white
4343
white = WhiteIndex(cfg.screen);
44-
black = BlackIndex(cfg.screen);
4544
grey = white / 2;
4645
inc = white - grey;
4746

@@ -73,7 +72,7 @@
7372
% ------------------------------ PLAYGROUND -------------------------------
7473
% -------------------------------------------------------------------------
7574
% Define Half-Size of the grating image.
76-
texsize = gratingSizePix / 2;
75+
textureSize = gratingSizePix / 2;
7776

7877
% First we compute pixels per cycle rounded to the nearest pixel
7978
pixPerCycle = ceil(1 / freqCyclesPerPix);
@@ -82,13 +81,15 @@
8281
freqRad = freqCyclesPerPix * 2 * pi;
8382

8483
% This is the visible size of the grating
85-
visibleSize = 2 * texsize + 1;
84+
visibleSize = 2 * textureSize + 1;
85+
8686

8787
% Define our grating. Note it is only 1 pixel high. PTB will make it a full
8888
% grating upon drawing
89-
x = meshgrid(-texsize:texsize + pixPerCycle, 1);
89+
x = meshgrid(-textureSize:textureSize + pixPerCycle, 1);
9090
grating = grey * cos(freqRad*x) + inc;
9191

92+
9293
% Make a two layer mask filled with the background colour
9394
mask = ones(1, numel(x), 2) * grey;
9495

@@ -98,14 +99,16 @@
9899
% Make our grating mask texture
99100
gratingMaskTex = Screen('MakeTexture', cfg.win, mask);
100101

102+
101103
% Make a black and white noise mask half the size of our grating. This will
102104
% be scaled upon drawing to make a "chunky" noise texture which our grating
103105
% will mask. Note the round function in here. For this demo we are simply
104106
% rounding the size to the nearest pixel, leaving PTB to do some scaling.
105107
noise = rand(round(visibleSize / 2)) .* white;
106108

107109
% Make our noise texture
108-
noiseTex = Screen('MakeTexture', cfg.win, noise);
110+
noiseTexture = Screen('MakeTexture', cfg.win, noise);
111+
109112

110113
% Make a destination rectangle for our textures and center this on the
111114
% screen
@@ -143,7 +146,7 @@
143146
srcRect = [xoffset 0 xoffset + visibleSize visibleSize];
144147

145148
% Draw noise texture to the screen
146-
Screen('DrawTexture', cfg.win, noiseTex, [], dstRect, []);
149+
Screen('DrawTexture', cfg.win, noiseTexture, [], dstRect, []);
147150

148151
% Draw grating mask
149152
Screen('DrawTexture', cfg.win, gratingMaskTex, srcRect, dstRect, []);

0 commit comments

Comments
 (0)