/usr/share/psychtoolbox-3/PsychTests/FillPolyTest.m is in psychtoolbox-3-common 3.0.11.20131230.dfsg1-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | function FillPolyTest
% FillPolyTest
%
% Test Screen 'FillPoly' for speed and correctness.
%
% Screen 'FillPoly' renders both convex and concave polygons, but treats
% them differently; Convex polygons it renders quickly using GL_POLYGON.
% Concave polygons it renders slowly using GLU tesselators.
%
% FillPolyTest draws a "Butterfly" concave polygon to test if FillPolly
% correctly detects and renders concave polygons. If FillPoly failed to
% detect concavity, it would use GL_POLYGON, which renders concave polygons
% incorrectly.
% HISTORY
%
% mm/dd/yy
%
% 1/15?/05 mk created it.
% 1/25/05 awi Merged into Psychtoolbox.org distribution.
% Renamed to TestFillPolyOSX.
% Minor changes to description text.
% Added a history section.
doublebuffer=1;
try
% This script calls Psychtoolbox commands available only in OpenGL-based
% versions of the Psychtoolbox. (So far, the OS X Psychtoolbox is the
% only OpenGL-based Psychtoolbox.) The Psychtoolbox command AssertPsychOpenGL will issue
% an error message if someone tries to execute this script on a computer without
% an OpenGL Psychtoolbox
AssertOpenGL;
% Get the list of OldScreens and choose the one with the highest screen number.
% Screen 0 is, by definition, the display with the menu bar. Often when
% two monitors are connected the one without the menu bar is used as
% the stimulus display. Chosing the display with the highest dislay number is
% a best guess about where you want the stimulus displayed.
screens=Screen('Screens');
screenNumber=max(screens);
% Open a double buffered fullscreen window and draw a gray background
% and front and back buffers. On OS X we
w=Screen('OpenWindow',screenNumber, 0,[],32,doublebuffer+1);
if(doublebuffer)
Screen('Flip', w);
end;
% Polydrawtest:
pointList=zeros(36, 2);
for i=1:36
j=abs(sin(i*20/1*3.14/180));
pointList(i,1)=300 + 100 * j * cos((36-i)*10/1 * 3.14 / 180);
pointList(i,2)=300 + 100 * j * sin((36-i)*10/1 * 3.14 / 180);
end;
n=10;
t=GetSecs;
for i=1:n
Screen('FillPoly', w ,[255, 0, 0], pointList);
end;
t=(GetSecs - t) / n * 1000
Screen('FramePoly', w ,[0 255 0], pointList, 2);
if(doublebuffer)
Screen('Flip', w);
end;
KbWait;
%The same commands wich close onscreen and offscreen windows also close
%textures.
Screen('CloseAll');
catch
%this "catch" section executes in case of an error in the "try" section
%above. Importantly, it closes the onscreen window if its open.
Screen('CloseAll');
Priority(0);
rethrow(lasterror);
end %try..catch..
|