LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Flickering Picture

Claudia,
I am also trying to do human behavioral studies using LabView on a small budget. I share your pain. Unfortunately I invested a lot of time and effort in my labview6 program only to come up against the same obstacles you have. Part of my study involves subjects moving a cursor connected to a pot to track a moving target on the screen. I have tried all of the suggestions the gurus gave you, all to no avail. (I refresh the screen at 60Hz, but things still look bad if the cursor moves fast enough.) I was wondering if any of the gurus know how we could easily employ ActiveX for our displays. It seems that the cursor in Windows2000 always looks good, no matter how fast it moves.
--Melinda
0 Kudos
Message 21 of 26
(991 Views)
> I am also trying to do human behavioral studies using LabView on a
> small budget. I share your pain. Unfortunately I invested a lot of
> time and effort in my labview6 program only to come up against the
> same obstacles you have. Part of my study involves subjects moving a
> cursor connected to a pot to track a moving target on the screen. I
> have tried all of the suggestions the gurus gave you, all to no avail.
> (I refresh the screen at 60Hz, but things still look bad if the cursor
> moves fast enough.) I was wondering if any of the gurus know how we
> could easily employ ActiveX for our displays. It seems that the
> cursor in Windows2000 always looks good, no matter how fast it moves.


I'm sorry to hear that we have failed you, but if you are willing to
write the SW the right way, you can make it work. Active X will
probably not help that much. I'm not familiar with every control out
there, but what you really need to do is use lower level HW access, like
the cursor is doing. The LV graphics are done on top of Windows using
what is know as the GDI or graphics device interface. It helps to make
lots of video and printers work roughly the same, but it is sort of
primitive and sort of old. It doesn't expose enough control to be able
to reduce the flicker that you are talking about, because what you
really have to do is to synchronize the drawing with the monitor's
refresh. If they aren't in synch, then you get a jumpy update or you
get jagged graphics edges. It is much like setting up a strobe light.
You need to synchronize the other things in your experiment to the
strobe or everything gets out of whack.

As I said in my earlier post, I think the best way to accomplish this
flicker-free graphics is to use DirectDraw. It is part of DirectX and
is how many of the PC games are written. You may be able to do the
synchronization through OpenGL, but when we last checked, it was not in
the implementation that we wanted to use. Specifically what you want to
use is what is called double-buffering or back-buffering. It is where
two screens or windows worth of memory are set aside, and when a frame
of your drawing is complete, you schedule to have the buffers flipped.
This flipping will not occur while the CRT is tracing the screen, but
will wait until the next ~60HZ tick when it can swap pointers so that
the next trace will come from the complete buffer. This is really the
only way to guarantee that no flicker takes place because the image the
user sees is always complete, no partial images with old and new or
erased but still drawing.

I know that this sounds like something that should be more simple, but
it is one of those things that game SW deals with all the time and other
SW really doesn't need, therefore normal graphics APIs don't support it.

FYI, the poor man's method of doing this is to use a bitmap to draw the
graphics and copy the bitmap to the screen when everything is ready.
This is what LV does to provide smooth updates or offscreen drawing. It
gets rid of most flicker, but not all.

Sorry that there isn't a simpler solution.
Greg McKaskle
0 Kudos
Message 22 of 26
(991 Views)
Hi Claudia,

I am going to try a different approach to your problem: I'll try to use the IMAQ functions to create a moving rectangle in a pixmap and display it in an IMAQ window. I think this should work, the only draw back is that it needs the IMAQ functions toolkit.
Just give me some time and I'll let you know.

Alberto
0 Kudos
Message 23 of 26
(991 Views)
Hi Claudia,
as promised in my previous post, I developed a sample vi that generates a black line moving from rigth to left on an IMAQ white window.
This seems to be less flickering than the LV picture method.
Two things:
-You need the advanced IMAQ functions...
-The speed to move the rectangle without flickering depends on your pc speed, in fact this vi uses all the cpu resources.
Let me know if you need some explaination.
Good luck,

Alberto
0 Kudos
Message 24 of 26
(991 Views)
If you dont care much about dynamically altering the shape and color of the object, you could just move a control around the front panel. They dont suffer from the flickering of redraw. Put a old style flat boolean, create a property node and wire your already calculated 'top' and 'left' values to its position property.

If the dynamic attribute changes are what you are after, this solution wont help much because the controls cant be resized at run-time (most controls you can recolor though).

My 2 cents.
0 Kudos
Message 25 of 26
(991 Views)
Thanks for all of your new ideas. I tried to move around a boolean instead of updating a picture control, but it still flickers at the rate I'm moving it. Also, I'm doing continuous analog acquisition during all of this and for some reason moving around a boolean with a property node creates a lot of memory overhead and my scan backlog ramps up. The same is true for the bitmap suggestion made earlier -- so far using an invoke node to make the bitmap (the easiest way I can think of to do it) creates a lot of overhead also. I have 512K of RAM...maybe I need to kill other processes. Anyway, the problem isn't that big of a deal...it's just annoying because my software will be used to study the brains of old people and I'd like to minimize the distractions.

I really appreciate all of your help with this hairy problem.
--Melinda (Please note that I'm new to this list and am not the original question submitter.)
0 Kudos
Message 26 of 26
(990 Views)