GLSL shaders operate on every pixel independently, with the current pixel position given by
vec2 pos = gl_TexCoord.xy; so
pos.x is the X position and
pos.y is the y position. You can then do all sorts of polar ↔ cartesian magic.
Anyway for your needs, a simpler shortcut is to just use
Screen('FillArc') to draw an arc over the procedural texture that will act as a mask:
Add this code to the demo to define a centered rect:
segmentRect = [0 0 600 600];
segmentRect = CenterRectOnPointd(segmentRect, width/2, height/2);
and then draw over the procedural texture:
Screen('DrawTexture', win, texture, , ,...
angle, , , baseColor, , ,...
[phase, radialFrequency, contrast, sigma, circularFrequency, 0, 0, 0]);
Screen('DrawTexture', win, masktex, , maskDstRects, , , 1, baseColor, , );
Screen('FillArc', win, baseColor, segmentRect, 45, 270);
270 to rotate the segment as needed…
EDIT: sorry I forgot you wanted contrast modulation, you change the alpha opacity of the mask which would reduce the contrast, although not in “formally” precise way, but may good enough for your needs…