DriftDemo4

>Psychtoolbox>PsychDemos

function DriftDemo4([angle=0][, cyclespersecond=1][, freq=1/360][, gratingsize=360][, internalRotation=0])
___________________________________________________________________

Display an animated grating, using the new Screen(‘DrawTexture’) command.
This demo demonstrates fast drawing of such a grating via use of procedural
texture mapping. It only works on hardware with support for the GLSL
shading language, vertex- and fragmentshaders. The demo ends if you press
any key on the keyboard.

The grating is not encoded into a texture, but instead a little algorithm - a
procedural texture shader - is executed on the graphics processor (GPU)
to compute the grating on-the-fly during drawing.

This is very fast and efficient! All parameters of the grating can be
changed dynamically. For a similar approach wrt. Gabors, check out
ProceduralGaborDemo. For an extremely fast aproach for drawing many Gabor
patches at once, check out ProceduralGarboriumDemo. That demo could be
easily customized to draw many sine gratings by mixing code from that
demo with setup code from this demo.

Optional Parameters:
‘angle’ = Rotation angle of grating in degrees.
‘internalRotation’ = Shall the rectangular image patch be rotated
(default), or the grating within the rectangular patch?
gratingsize = Size of 2D grating patch in pixels.
freq = Frequency of sine grating in cycles per pixel.
cyclespersecond = Drift speed in cycles per second.

Path   Retrieve current version from GitHub | View changelog
Psychtoolbox/PsychDemos/DriftDemo4.m