LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Canvas update - sync with vertical retrace

Dear experts,

I am using CVI an WinXP and need a way to syncronzie the updating of a canvas with the vertical retrace of the control to get around the flicker effect when the update occurs. Is there a way in CVI?

cheers

0 Kudos
Message 1 of 7
(3,950 Views)

Could you post a flickering example?

 

I running XP and don't see the flicker on a canvas update.

 

What version of CVI are you using?

0 Kudos
Message 2 of 7
(3,930 Views)

Yes sure, please see attached, if you update the canvas you can see that the redraw starts at a radom vertical position leading to a perceived flicker. I'd like to be able to syncronize the update with the vertical retrace similar to what Psycotoolbox allows from Matlab (http://psychtoolbox.org/wikka.php?wakka=PsychtoolboxOverview)

 

cheers

 

0 Kudos
Message 3 of 7
(3,901 Views)

Using your project, I do see the effect you're talking about (drawing the rectangle doesn't necessarily start at the top of the canvas, so you can sometimes very briefly see the rectangle as half white and half black).

 

I'm sorry I haven't found a solution.  I tried setting the ATTR_DRAW_POLICY to VAL_MARK_FOR_UPDATE, and then updating later.  I tried dimming the canvas while the update occured and then undimming it.  I tried using ProcessDrawEvents() before the callback returned.  Nothing seemed to have any impact.

 

Since Psychtoolbox has an interface to MatLab, have you looked at interfacing CVI to Matlab?

 

As a suggestion for you future postings, when you post a project, we don't need you .EXE files and your .CDB files.  I'll rebuild your project anyway, not trusting a .EXE file I downloaded from the web.  Just post your .prj, .uir, .c, and .h files.  That will make your posting quicker, our download quicker, and will require less space on the NI servers and on our harddrives.

0 Kudos
Message 4 of 7
(3,867 Views)

Hi and thanks for the advice re. uploads, will do next time.

In terms of the flicker, is there anyone else who might have an idea? I think it should be along the lines of checking the current vertical position of the image refresh and wait until it is on top. Some video related functionality perhaps? I urgently need a fix for that and would appreciate any help. Interfacing to Matlab would require a lot of extra work as my C code is calibrated and validated and I'd have to port the entire algorithm.

cheers

 

0 Kudos
Message 5 of 7
(3,864 Views)

Just a quick guess: some sort of double buffering. Try two canvases ontop of each other and update the one hidden by the other, then switch by changing the z position. I didn't try it, but it may work.

-----------------------
/* Nothing past this point should fail if the code is working as intended */
0 Kudos
Message 6 of 7
(3,845 Views)

thanks mate, tried that with he same result, I guess a z plane change is nothing but a redraw too and if the redraw can't be synchronized with the monitor's vertical retrace the result is the same 😞 Does anyone else have a possible solution?

0 Kudos
Message 7 of 7
(3,819 Views)