/usr/share/psychtoolbox-3/PsychTests/DrawingIntoTexturesTest.m is in psychtoolbox-3-common 3.0.11.20140816.dfsg1-1.
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 | function DrawingIntoTexturesTest(imagingmode)
AssertOpenGL;
screenid = max(Screen('Screens'));
if nargin < 1
imagingmode = [];
end
if isempty(imagingmode)
imagingmode = 0;
end
if imagingmode > 0
imagingmode = kPsychNeedFastBackingStore;
floatflag = 2;
else
imagingmode = 0;
floatflag = 0;
end
% Open window, with or without imaging pipeline:
win = Screen('OpenWindow', screenid, 255, [], [], [], [], [], imagingmode);
Screen('Blendfunction', win, GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for floatprec =0:floatflag
for layers=1:4
fprintf('Testing Drawing into %i layer textures of precision mode %i...\n', layers, floatprec);
inimg = imread([PsychtoolboxRoot 'PsychDemos/konijntjes1024x768.jpg']);
switch layers
case 1,
teximg = rgb2gray(inimg);
case 2,
teximg = randn(size(inimg, 1), size(inimg, 2), 2) * 255;
teximg(:,:,1) = rgb2gray(inimg);
case 3,
teximg = inimg;
case 4,
teximg = randn(size(inimg, 1), size(inimg, 2), 4) * 255;
teximg(:,:,1:3) = inimg;
end
if (floatprec>0)
teximg = double(teximg)/255.0;
end
tex = Screen('MakeTexture', win, teximg, [], [], floatprec);
DrawFormattedText(tex, ['Everything is fine with ' num2str(layers) ' layers of precision' num2str(floatprec) '...'], 'center', 'center');
Screen('DrawTexture', win, tex);
Screen('Flip', win);
while KbCheck; end;
KbWait;
end
end
Screen('CloseAll');
|