09-19-2010 10:35 PM
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
09-20-2010 08:17 AM - edited 09-20-2010 08:19 AM
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?
09-20-2010 08:23 PM
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
09-21-2010 05:26 PM
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.
09-21-2010 06:33 PM
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
09-22-2010 02:49 AM - edited 09-22-2010 02:50 AM
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.
09-22-2010 06:22 PM
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?