LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Redraw 2d Picture without flashing

I use a 2D picture indicator to display a large grid of rectangles representing state in a grid of wells that my machine is working with. I would like to be able to update it rapidly as the state of any particular well changes, but it appears that the only refresh mode LabVIEW supports is to redraw the whole picture. And it seems to insist on drawing the background white, first. That means that a rapid series of updates results in a rapid series of flashes on the screen and very inefficient redrawing. Unusable. If

Is there a way to do better? Is there a way to get the LabVIEW picture to draw over its former state without drawing the background first? Is there a way to update only a part of the picture, physically?

0 Kudos
Message 1 of 8
(253 Views)

Check the help file for a picture control.

 

Did you right click the control and and uncheck "Erase First" on the menu?

0 Kudos
Message 2 of 8
(231 Views)

Have you tried to defer panel updates while doing the scaling operations?  This should eliminate the "flickering".

0 Kudos
Message 3 of 8
(224 Views)

@Joymaker wrote:

I use a 2D picture indicator to display a large grid of rectangles representing state in a grid of wells that my machine is working with. I would like to be able to update it rapidly as the state of any particular well changes, but it appears that the only refresh mode LabVIEW supports is to redraw the whole picture. And it seems to insist on drawing the background white, first. That means that a rapid series of updates results in a rapid series of flashes on the screen and very inefficient redrawing. Unusable. If

Is there a way to do better? Is there a way to get the LabVIEW picture to draw over its former state without drawing the background first? Is there a way to update only a part of the picture, physically?


could you post some code and an example picture?

 

People don’t do what you expect, but what you inspect.
- Louis V. Gerstner, IBM
0 Kudos
Message 4 of 8
(214 Views)

Thanks, RavensFan, that led to considerable improvement. But not all that I need. My strategy is to draw a "layer" as a series of colored rectangles, and then to update them one by one with fresh, single Draw Rectangle.vi operations updating the value of the 2D Picture indicator as my chemistry proceeds.

But then, as the indicator redraws, I see the old state flickering momentarily underneath the new. The old colors and the old text (lowercase) flashes just before the new color and uppercase text takes over.


It appears that we're dealing with a display list. As if a new Draw Rectangle.vi

operation adds a command to the end of a list of commands that are freshly executed at each update, rather than modifying an offscreen pixel map and then updating that to the screen. And therefore, the more of these I do, the more cumbersome each successive update becomes.

Does anybody know if this is accurate? Because I have a placed a breakpoint in every place in my code that could possibly draw to the picture, and I'm not catching anything in my code that could be drawing the old state.

0 Kudos
Message 5 of 8
(172 Views)

In run mode right-click the picture indicator and choose 'Smooth Updates', or in edit mode you can find the option under the 'Advanced' pull-out menu.

0 Kudos
Message 6 of 8
(166 Views)
Highlighted

Asteroids.gif

Along with the erase first and the smooth updates you can try deferring panel updates while you calculate things. Also you should make sure that nothing is floating infront of the 2d picture control or LabVIEW is going to have a hard time as now it has to figure out how to render the floating object as well as the picture itself. Following these combinations I have redrawn 2d picture controls in excess of 60 fps.

 

I turned the game clock up so the physics in this gif look a little choppy but the idea was to show that that you can update in excess of 90fps with no flashing. As a side note asteroids is hard to play at 2x the speed. 

Message 7 of 8
(145 Views)

Is your asteroids game available somewhere?

0 Kudos
Message 8 of 8
(79 Views)