Fwd: Re: [psychtoolbox] new user: exact timing for display

>
>>Hi,
>> I'm a new user of the great toolbox. Here is a really elementary
>>question:
>>
>> My monitor is 75Hz, which would yield a 13.3ms/frame rate.
>> How do I precisely present an image for, say 1 frame, or just 2
>>frames? I used the following code to check, and the time that's
>>returned is some non-multiples of 13.3ms, I don't know what this
>>exactly mean for the actual amount of time that the window is on.
>>
>> FRAMERATE = 13.3333;
>> RED = [255 0 0];
>> BLACK = [0 0 0];
>> w = SCREEN(0, 'openwindow', BLACK);
>> ow = SCREEN(w, 'openoffscreenwindow', RED);
>> Start = getsecs * 1000
>> End = S + FRAMERATE * 1 % or 2
>> tic
>> while 1000*getsecs < End
>> SCREEN('copywindow', ow, w);
>> end
>> time = toc*1000;
>>
>> Thank you!
>>Fei FEi
>
>dear fei
>
>as you've realized, it's important to synchronize your software to
>the display. We do this by waiting for "blanking", which is the
>period of about 1 ms during which a CRT monitor is blank a the end
>of every frame.
>
>CopyWindow does not wait for blanking; it just copies to the
>graphic-card memory whenever you ask it to. If your image is small
>it might be able to do that many times during the time your display
>takes to show one frame.
>
>add "SCREEN(w,'WaitBlanking')" inside your loop.
>
>for an example, see MovieDemo. (try typing "help psychdemos" for a
>list of demos.)
>
>best
>
>denis
>
>p.s. TIC and TOC are handy and clever, but their timebase is rotten
>compared to that of GETSECS, so you'll be better off using GETSECS
>to do all your timing.
>
>also, there is a useful function called FrameRate, so you might be
>better off giving your FRAMERATE variable a different name that
>doesn't conflict, because MATLAB doesn't always notice differences
>in capitalization.