Flip, dontclear Flag

Hello,

I have problem with "dontclear" flag in Screen('Flip') command. Simply when I run the demo file "MouseTraceDemo2.m" it gives me the following error and jumps out of the program.

+++++++++++++++++++++++++++

Error in function Flip:     Usage error
OpenGL AUX buffers unavailable! dontclear=1 in Screen-Flip doesn't work without them.
Either unsupported by your graphics card, or you disabled them via call to Screen('Preference', 'ConserveVRAM')?
Usage:

% Activate compatibility mode: Try to behave like the old MacOS-9 Psychtoolbox:
oldEnableFlag=Screen('Preference', 'EmulateOldPTB', [enableFlag]);

>>> and the "help Screen" comments and then

??? Usage:

[VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] = Screen('Flip', windowPtr [, when] [, dontclear] [, dontsync] [, multiflip]);

Error in ==> MouseTraceDemo2 at 82
    psychrethrow(psychlasterror);

+++++++++++++++++++++++++++

I also add the command line below prior to the Flip command, but still it is the same.

oldEnableFlag=Screen('Preference', 'EmulateOldPTB', 1);

I'm using PTB 3 under Windows XP in Bootcamp (Sorry for degrading from MAC. Actually I love my machine's MAC side but I need to write this program in windows OS. It's terrible!). I have a 2 x Quad Xeon Intel MAC computer with video card ATI Radeon HD 2600 XT with driver version 2.1.7273.

What should I do? Thanks for your attention.

Best
Amir

Search the forum, this has been answered multiple
times.

--- In psychtoolbox@yahoogroups.com, "Amir Homayoun Javadi" <a.h.javadi@...> wrote:
>
> Hello,
>
> I have problem with "dontclear" flag in Screen('Flip') command. Simply when
> I run the demo file "MouseTraceDemo2.m" it gives me the following error and
> jumps out of the program.
>
> +++++++++++++++++++++++++++
>
> Error in function Flip: Usage error
> OpenGL AUX buffers unavailable! dontclear=1 in Screen-Flip doesn't work
> without them.
> Either unsupported by your graphics card, or you disabled them via call to
> Screen('Preference', 'ConserveVRAM')?
> Usage:
>
> % Activate compatibility mode: Try to behave like the old MacOS-9
> Psychtoolbox:
> oldEnableFlag=Screen('Preference', 'EmulateOldPTB', [enableFlag]);
>
> >>> and the "help Screen" comments and then
>
> ??? Usage:
>
> [VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] =
> Screen('Flip', windowPtr [, when] [, dontclear] [, dontsync] [, multiflip]);
>
> Error in ==> MouseTraceDemo2 at 82
> psychrethrow(psychlasterror);
>
> +++++++++++++++++++++++++++
>
> I also add the command line below prior to the Flip command, but still it is
> the same.
>
> oldEnableFlag=Screen('Preference', 'EmulateOldPTB', 1);
>
> I'm using PTB 3 under Windows XP in Bootcamp (Sorry for degrading from MAC.
> Actually I love my machine's MAC side but I need to write this program in
> windows OS. It's terrible!). I have a 2 x Quad Xeon Intel MAC computer with
> video card ATI Radeon HD 2600 XT with driver version 2.1.7273.
>
> What should I do? Thanks for your attention.
>
> Best
> Amir
>
Hello,
Dear Mario

Sorry for posting the comment before checking the forum. OK. I followed two of the solutions gone below

[theWindow,theRect] = Screen('OpenWindow', whichScreen, 0, [], [], [], [], [], kPsychNeedFastBackingStore);

and

PsychImaging('PrepareConfiguration');
PsychImaging('AddTask', 'General', 'UseVirtualFramebuffer');
[theWindow,theRect] = PsychImaging('OpenWindow', whichScreen, 0);

interestingly they can be ran for just one time. For the second run both of the solutions give the following error

Error in function OpenWindow:     Usage error
Sorry, imaging pipeline functions are not supported in OS-9 PTB emulation mode.

To resolve it, I ran the following commands before my second run

clear all
close all

and it is working now. What is the possible cause for that? And after a while even when I commented the above clear and close commands, the program works fine. Have I missed anything?

And what is difference between these two approaches?

Thanks for your reply.
Amir



2008/11/9 Mario Kleiner <mario.kleiner@...>

Search the forum, this has been answered multiple
times.



--- In psychtoolbox@yahoogroups.com, "Amir Homayoun Javadi" <a.h.javadi@...> wrote:
>
> Hello,
>
> I have problem with "dontclear" flag in Screen('Flip') command. Simply when
> I run the demo file "MouseTraceDemo2.m" it gives me the following error and
> jumps out of the program.
>
> +++++++++++++++++++++++++++
>
> Error in function Flip: Usage error
> OpenGL AUX buffers unavailable! dontclear=1 in Screen-Flip doesn't work
> without them.
> Either unsupported by your graphics card, or you disabled them via call to
> Screen('Preference', 'ConserveVRAM')?
> Usage:
>
> % Activate compatibility mode: Try to behave like the old MacOS-9
> Psychtoolbox:
> oldEnableFlag=Screen('Preference', 'EmulateOldPTB', [enableFlag]);
>
> >>> and the "help Screen" comments and then
>
> ??? Usage:
>
> [VBLTimestamp StimulusOnsetTime FlipTimestamp Missed Beampos] =
> Screen('Flip', windowPtr [, when] [, dontclear] [, dontsync] [, multiflip]);
>
> Error in ==> MouseTraceDemo2 at 82
> psychrethrow(psychlasterror);
>
> +++++++++++++++++++++++++++
>
> I also add the command line below prior to the Flip command, but still it is
> the same.
>
> oldEnableFlag=Screen('Preference', 'EmulateOldPTB', 1);
>
> I'm using PTB 3 under Windows XP in Bootcamp (Sorry for degrading from MAC.
> Actually I love my machine's MAC side but I need to write this program in
> windows OS. It's terrible!). I have a 2 x Quad Xeon Intel MAC computer with
> video card ATI Radeon HD 2600 XT with driver version 2.1.7273.
>
> What should I do? Thanks for your attention.
>
> Best
> Amir
>


This is a funny one, a nice little "chain reaction".

The error in Screen('Flip') triggers
the error handling in the catch clause inside Mousetracedemo2,
there a function Screen('ShowCursor') gets called, but no
such function exists (a call to ShowCursor; would have been
correct). In response, the Screen command prints out
its overview of all commands - the same you'd get by
simply typing Screen + Enter.

You followed the "instructions" to enable PTB-2
compatibility mode (which actually weren't instructions
but simply the topmost output of the command overview),
then at next run of a demo PTB was switched into this
compatibility mode, which doesn't support most of the
new functions so you got that error message.

A "clear all" resets everything -- and is actually highly
recommended after a script aborts with some error
for that reason.

So after "clear all", PTB was again in its normal PTB-3 mode
and everything worked.

So:

1. We need to fix those demos error handling.
2. If in doubt, after any error, type "clear all".

3. Screen retains its Screen('Preference',...) settings until
you change them or do a clear all.
4. Some of our M-Files internally cache some settings
across invocations to save computation time, so after an
error abort, they may be in an undefined state, unless
clear all is called.


The compatibility mode is only to help people with
ancient PTB-2 code to keep that code working on
PTB-3 or at least to simplify porting of that code
to PTB-3. It's a band-aid, not recommended for
new code, and even for old code one would be
better off porting the code properly. Most interesting
new features get disabled in compatibility mode.

The difference between

> [theWindow,theRect] = Screen('OpenWindow', whichScreen, 0, [], [], [], [],
> [], kPsychNeedFastBackingStore);
>
> and
>
> PsychImaging('PrepareConfiguration');
> PsychImaging('AddTask', 'General', 'UseVirtualFramebuffer');
> [theWindow,theRect] = PsychImaging('OpenWindow', whichScreen, 0);
>

is exactly zero. The latter internally invokes the former,
but only in this simple special case. Use the PsychImaging
interface. It provides many useful functions and
performs all the complex'n dirty low-level setup
work for you, takes care of special cases, workarounds
for broken hardware and drivers etc.

help PsychImaging for an overview. The latter is
easier to use and understand in 95% of all cases.

-mario
Oh, so thanks for your detailed response. Now I see that "clear all" does more than just clearing the workspace, specially the variables which are visible in "workspace" window. Thanks,

Amir



2008/11/9 Mario Kleiner <mario.kleiner@...>

This is a funny one, a nice little "chain reaction".

The error in Screen('Flip') triggers
the error handling in the catch clause inside Mousetracedemo2,
there a function Screen('ShowCursor') gets called, but no
such function exists (a call to ShowCursor; would have been
correct). In response, the Screen command prints out
its overview of all commands - the same you'd get by
simply typing Screen + Enter.

You followed the "instructions" to enable PTB-2
compatibility mode (which actually weren't instructions
but simply the topmost output of the command overview),
then at next run of a demo PTB was switched into this
compatibility mode, which doesn't support most of the
new functions so you got that error message.

A "clear all" resets everything -- and is actually highly
recommended after a script aborts with some error
for that reason.

So after "clear all", PTB was again in its normal PTB-3 mode
and everything worked.

So:

1. We need to fix those demos error handling.
2. If in doubt, after any error, type "clear all".

3. Screen retains its Screen('Preference',...) settings until
you change them or do a clear all.
4. Some of our M-Files internally cache some settings
across invocations to save computation time, so after an
error abort, they may be in an undefined state, unless
clear all is called.

The compatibility mode is only to help people with
ancient PTB-2 code to keep that code working on
PTB-3 or at least to simplify porting of that code
to PTB-3. It's a band-aid, not recommended for
new code, and even for old code one would be
better off porting the code properly. Most interesting
new features get disabled in compatibility mode.

The difference between



> [theWindow,theRect] = Screen('OpenWindow', whichScreen, 0, [], [], [], [],
> [], kPsychNeedFastBackingStore);
>
> and
>
> PsychImaging('PrepareConfiguration');
> PsychImaging('AddTask', 'General', 'UseVirtualFramebuffer');
> [theWindow,theRect] = PsychImaging('OpenWindow', whichScreen, 0);
>

is exactly zero. The latter internally invokes the former,
but only in this simple special case. Use the PsychImaging
interface. It provides many useful functions and
performs all the complex'n dirty low-level setup
work for you, takes care of special cases, workarounds
for broken hardware and drivers etc.

help PsychImaging for an overview. The latter is
easier to use and understand in 95% of all cases.

-mario