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

« back to all changes in this revision

Viewing changes to Psychtoolbox/PsychOneliners/PsychDebugWindowConfiguration.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:
2
2
% Switch PTB's onscreen window into a display mode suitable for easy debugging on single-screen setups.
3
3
%
4
4
% This function allows to setup Screen onscreen windows to be
5
 
% half-transparent, so one can simultaneously see the stimulus display and
 
5
% partially transparent, so one can simultaneously see the stimulus display and
6
6
% the Matlab window and other GUI windows.
7
7
%
8
8
% Usage: PsychDebugWindowConfiguration([opaqueForHID=0][, opacity=0.5])
9
9
%
10
10
% To enable: Call PsychDebugWindowConfiguration before the Screen('OpenWindow',...) call!
11
 
% To disable: Type "clear Screen"
 
11
% To disable: Type "clear Screen" or "clear all".
12
12
%
13
13
% The optional parameter 'opaqueForHID' if set to a non-zero value will
14
14
% disallow mouse clicks and other mouse actions to "get through" to the
15
15
% GUI, ie., it will make the onscreen window opaque to the mouse pointer.
16
16
%
17
 
% A setting of -1 will disable the debug mode again.
 
17
% A setting of -1 will disable the transparency again, but *keep all timing tests
 
18
% and timestamping disabled*.
18
19
%
19
20
% The optional parameter 'opacity' controls how opaque the onscreen window
20
21
% is, in a range of 0.0 to 1.0 for 0% to 100% opacity. By default the
26
27
%
27
28
% This feature will only work reliably - or at all - if your operating
28
29
% system is running with a compositing window manager installed and
29
 
% enabled. This is the case for Windows Vista, Windows-7 and later MS
30
 
% operating systems, MacOS/X, and GNU/Linux distributions that have the
31
 
% Compiz window manager installed and enabled, e.g., Ubuntu-9.1 and later.
 
30
% enabled. This is the case for Windows Vista, Windows-7/8 and later MS
 
31
% operating systems, as well as MacOS/X, and most GNU/Linux distributions
 
32
% which have a compositing desktop installed and enabled, e.g., KDE,
 
33
% GNOME-2/3, Compiz, Unity.
32
34
%
33
35
% Keyboard and mouse input may not work as expected under all conditions,
34
36
% i.e., it may by impaired in either Psychtoolbox, or for the other running
38
40
% History:
39
41
% 30.07.2009 mk  Written.
40
42
% 15.11.2009 mk  Now also for Windows and Linux.
 
43
% 22.08.2013 mk  Disable any high-precision timestamping on all operating systems.
 
44
% 09.09.2013 mk  No special case handling for OSX needed anymore.
41
45
 
42
46
if nargin < 1
43
47
    opaqueForHID = [];
51
55
    opacity=0.5;
52
56
end
53
57
 
54
 
if IsOSX
55
 
    % Disable high precision timestamping:
56
 
    Screen('Preference', 'VBLTimestampingMode', -1);
57
 
 
58
 
    % Skip sync tests:
59
 
    Screen('Preference', 'SkipSyncTests', 2);
60
 
 
61
 
    % Use AGL + Carbon, even for fullscreen windows:
62
 
    oldconserve = Screen('Preference', 'ConserveVRAM');
63
 
    Screen('Preference', 'ConserveVRAM', bitor(oldconserve, 16384));
64
 
end
65
 
 
66
 
if IsLinux | IsWin
67
 
    % Skip sync tests:
68
 
    Screen('Preference', 'SkipSyncTests', 2);
69
 
end
 
58
% Disable high precision timestamping:
 
59
Screen('Preference', 'VBLTimestampingMode', -1);
 
60
 
 
61
% Skip sync tests:
 
62
Screen('Preference', 'SkipSyncTests', 2);
70
63
 
71
64
% Map range 0.0 - 1.0 to 0 - 499:
72
65
opacity = floor(opacity * 499);