NewFastFilteredNoiseDemo([filtertype=1][, rectSize=128][, kwidth=5][, scale=1][, syncToVBL=1][, dontclear=0][, validate=0])
Demonstrates how to generate, filter and draw noise patches on-the-fly
in a fast way by use of GLSL fragment shaders.
Use it to benchmark your system by varying the load. If you like this demo
then also have a look at FastMaskedNoiseDemo that shows how to
efficiently draw a masked stimulus by use of alpha-blending.
filtertype = Type of filter to apply, see switch statement below for
supported filters. Zero selects no filtering, 1 is Gaussian blur.
rectSize = Size of the generated random noise image: rectSize by rectSize
pixels. This is also the size of the Psychtoolbox noise
kwidth = For filters which support a varying kernel size, the kernel
size. Will create a kwidth x kwidth convolution kernel.
scale = Scalefactor to apply to texture during drawing: E.g. if you’d set
scale = 2, then each noise pixel would be replicated to draw an image
that is twice the width and height of the input noise image. In this
demo, a nearest neighbour filter is applied, i.e., pixels are just
replicated, not bilinearly filtered – Important to preserve statistical
independence of the random pixel values!
syncToVBL = 1=Synchronize bufferswaps to retrace. 0=Swap immediately when
drawing is finished. Value zero is useful for benchmarking the whole
system, because your measured framerate will not be limited by the
monitor refresh rate – Gives you a feeling of how much headroom is left
in your loop.
dontclear = If set to 1 then the backbuffer is not automatically cleared
to background color after a flip. Can save up to 1 millisecond on old
Two patches, 256 by 256 noise pixels each, scaled by any factor between 1
and 5 yields a redraw rate of 100 Hz.
One patch, 256 by 256 noise pixels, scaled by any factor between 1
and 5 yields a redraw rate of 196 Hz.
Two patches, 128 by 128 noise pixels each, scaled by any factor between 1
and 5 yields a redraw rate of 360 - 380 Hz.
One patch, 128 by 128 noise pixels, scaled by any factor between 1
and 5 yields a redraw rate of 670 Hz.