Docs @ Psychtoolbox Wiki : ProceduralGratingDemo

Search PTB Function help:
homepsychtoolbox.orgpage updateslogin

ProceduralGratingDemo

PsychtoolboxPsychDemos

ProceduralGratingDemo([benchmark=0])

This demo demonstrates fast drawing of grating patches via use procedural
texture mapping. It only works on hardware with support for the GLSL
shading language, vertex- and fragment-shaders.

Gabors are not encoded into a texture, but instead a little algorithm - a
procedural texture shader - is executed on the graphics processor (GPU).
This is very fast and efficient! All parameters of the gabor patch can be
set individually.

This demo is both, a speed benchmark, and a correctness test. If executed
with the optional benchmark flag set to 2, it will execute a loop
where it repeatedly draws a gabor patch both on the GPU (new style) and
with Matlab code, then reads back and verifies the images, evaluating the
maximum error between the old Matlab method and the new GPU method. The
maximum error value and plotted error map are a means to assess if
procedural shading works correctly on your setup and if the accuracy is
sufficient for your purpose. In benchmark mode (flag set to 1), the gabor
is drawn as fast as possible, testing the maximum rate at which your
system can draw gabors.

At a default setting of benchmark==0, it just shows nicely drawn gabor.

Typical results on a MacBookPro with Radeon X1600 under OS/X 10.4.11 are:
Accuracy: Error wrt. Matlab reference code is 0.0005536900, i.e., about
1 part in 2000, equivalent to a perfect display on a gfx-system with 11 bit
DAC resolution. Note that errors scale with spatial frequency and
absolute magnitude, so real-world errors are usually smaller for typical
stimuli. This is just the error given the settings in this script.
Typical speed is 2800 frames per second.

Typical result on Intel Pentium IV, running on WindowsXP with a NVidia
Geforce7800 and up to date drivers: Error is 0.0000146741 units, ie. one
part in 68000, therefore perfect even on a display device with 15 bit
DAC's. The framerate is about 2344 frames per second.

If you want to draw many gabors, you wouldn't do it like in this script,
but use the batch-drawing version of Screen('DrawTextures', ...) instead,
as demonstrated, e.g., in DrawingSpeedTest.m




Path
Psychtoolbox/PsychDemos/ProceduralGratingDemo.m

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.0483 seconds