~ubuntu-branches/ubuntu/trusty/psychtoolbox-3/trusty-proposed

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychTests/ResolutionTest.m

  • Committer: Package Import Robot
  • Author(s): Yaroslav Halchenko
  • Date: 2013-11-19 23:34:50 UTC
  • mfrom: (3.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20131119233450-f7nf92vb8qavjmk8
Tags: 3.0.11.20131017.dfsg1-3
Upload to unsable since fresh glew has arrived to sid!

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function ResolutionTest
 
 
b"% ResolutionTest prints screen resolutions reported by Screen 'Resolution' "
 
 
b"% and 'Resolutions'. "
 
 
b'% '
 
 
b'% Also see SetResolution, NearestResolution, and Screen Resolution and Resolutions.'
 
 
b'% '
 
 
b'% Denis Pelli'
 
 
b'% 1/27/00 dgp Wrote it.'
 
 
b'% 9/17/01 dgp Added "recommended" to the report.'
 
 
b'% 4/24/02 awi Exit on PC with message.'
 
 
b'% Test every screen'
 
 
b"for screenNumber=Screen('Screens')"
 
 
b'\t% Describe video card'
 
 
b'\t% DescribeScreen(screenNumber);'
 
 
b"\tfprintf('\\nCURRENT RESOLUTION:\\n');"
 
 
b"\tres=Screen(screenNumber,'Resolution');"
 
 
b'\tdisp(res);'
 
 
b'\t'
 
 
b'\tif 0'
 
 
b"\t\tres=screen(screenNumber,'Resolutions');"
 
 
b"\t\tfprintf('mode %-29s valid safe rec recNow default interlaced\\n','resolution');"
 
 
b'\t\tfor i=1:length(res)'
 
 
b"\t\t\tfprintf('%3d  %-29s  %-5d %-4d %-3d %-6d %-7d %-10d\\n',res(i).mode,res(i).name,res(i).valid,res(i).safe,res(i).recommended,res(i).recommendNow,res(i).default,res(i).interlaced);"
 
 
b'\t\tend'
 
 
b"\t\tfprintf('\\n')"
 
 
b'\tend'
 
 
b'\t'
 
 
b'\tif 0'
 
 
b"\t\tres=screen(screenNumber,'Resolutions');"
 
 
b"\t\tfprintf('mode %-21s pixelSize\\n','resolution');"
 
 
b'\t\tfor i=1:length(res)'
 
 
b"\t\t\tfprintf('%3d ',res(i).mode);"
 
 
b"\t\t%\tfprintf('%-29s  ',res(i).name);"
 
 
b"\t\t\tfprintf('%4d x %4d   %3.0f Hz   ',res(i).width,res(i).height,res(i).hz);"
 
 
b'\t\t\tfor j=1:length(res(i).pixelSizes)'
 
 
b"\t\t\t\tfprintf('%d ',res(i).pixelSizes(j));"
 
 
b'\t\t\tend'
 
 
b"\t\t\tfprintf('bits\\n');"
 
 
b'\t\tend'
 
 
b"\t\tfprintf('\\n')"
 
 
b'\tend'
 
 
b'\t'
 
 
b"\tfprintf('\\nSCREEN %i: AVAILABLE RESOLUTIONS:\\n', screenNumber);"
 
 
b"\t% fprintf('mode %-29s         pixelSize\\n','resolution');"
 
 
b"\tres=Screen(screenNumber,'Resolutions');"
2
1
   oldres = '';
3
2
   
 
 
b'\tfor i=1:length(res)'
4
3
       resname = sprintf('%dx%d ', res(i).width, res(i).height);
5
4
       if isempty(strfind(oldres, resname))
6
5
           oldres = [oldres resname];
7
6
           fprintf('%d x %d\n', res(i).width, res(i).height);
8
7
       end
9
8
       
10
9
       %fprintf('%3d  ',res(i).mode);
 
 
b"\t\t%fprintf('%-29s  ',res(i).name);"
11
10
       %                s=sprintf('%d',res(i).pixelSizes(1));;
12
11
       %                for j=2:length(res(i).pixelSizes)
13
12
       %                        s=sprintf('%s,%d',s,res(i).pixelSizes(j));
14
13
       %                end
15
14
       %                fprintf('%14s bits   ',s);
16
15
       %                if res(i).safe
17
16
       %                        fprintf('safe  ');
18
17
       %                else
19
18
       %                        fprintf('      ');
20
19
       %                end
21
20
       %                if res(i).recommended
22
21
       %                        fprintf('recommended  ');
23
22
       %                else
24
23
       %                        fprintf('             ');
25
24
       %                end
 
 
b"\t\t%       fprintf('\\n');"
 
 
b'\tend'
 
 
b'end'
 
 
b'% DescribeScreen(-1); % end of table'
 
 
b'\\ No newline at end of file'
 
25
function ResolutionTest
 
26
% ResolutionTest prints screen resolutions reported by Screen 'Resolution'
 
27
% and 'Resolutions'.
 
28
%
 
29
% Also see SetResolution, NearestResolution, and Screen Resolution and Resolutions.
 
30
%
 
31
% Denis Pelli
 
32
 
 
33
% 1/27/00 dgp Wrote it.
 
34
% 9/17/01 dgp Added "recommended" to the report.
 
35
% 4/24/02 awi Exit on PC with message.
 
36
% 10/7/12 mk  Clean it up. Output refresh rates an pixelsize as well.
 
37
 
 
38
% Test every screen
 
39
for screenNumber=Screen('Screens')
 
40
    % Describe video card
 
41
    % DescribeScreen(screenNumber);
 
42
    
 
43
    fprintf('\nCURRENT RESOLUTION:\n');
 
44
    res=Screen(screenNumber,'Resolution');
 
45
    disp(res);
 
46
    
 
47
    fprintf('\nSCREEN %i: AVAILABLE RESOLUTIONS:\n', screenNumber);
 
48
    res=Screen(screenNumber,'Resolutions');
 
49
    oldres = '';
 
50
    
 
51
    for i=1:length(res)
 
52
        resname = sprintf('%dx%d ', res(i).width, res(i).height);
 
53
        if isempty(strfind(oldres, resname))
 
54
            oldres = [oldres resname]; %#ok<*AGROW>
 
55
            fprintf('%d x %d\n', res(i).width, res(i).height);
 
56
        end
 
57
    end
 
58
    
 
59
    fprintf('\nSCREEN %i: AVAILABLE DETAILED RESOLUTIONS:\n', screenNumber);
 
60
    res=Screen(screenNumber,'Resolutions');
 
61
    for i=1:length(res)
 
62
        fprintf('%4d x %4d   %3.0f Hz %d ',res(i).width,res(i).height,res(i).hz, res(i).pixelSize);
 
63
        fprintf('bits\n');
 
64
    end
 
65
    fprintf('\n')
 
66
end