05-21-2019 10:10 PM
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?
05-21-2019 11:46 PM
Check the help file for a picture control.
Did you right click the control and and uncheck "Erase First" on the menu?
05-22-2019 04:50 AM
@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?
06-07-2019 06:05 PM - edited 06-07-2019 06:07 PM
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.
06-07-2019 06:32 PM
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.
06-10-2019 06:12 PM
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.
06-12-2019 05:37 PM
Is your asteroids game available somewhere?
06-17-2019 11:18 AM
Not currently. Where do you think the best place to add it would be?
06-18-2019 06:21 AM
@əʞɐſ wrote:
Not currently. Where do you think the best place to add it would be?
Probably here:
https://forums.ni.com/t5/Example-Programs/tkb-p/3039
I do have a faint recollection of a game specific forum, but can't seem to find it (after looking briefly).
06-18-2019 02:20 PM
As regards your "Asteroids" game (which looks awesome, BTW) as a submission...
I had to search under my own profile, and it was about ten years ago, but I posted both a "Staroids" and a "Tank" game (neither of which were my creations, and I could only find creator info on one of them). Not sure if the forums were reorganized over the intervening years, but they appear to be under:
Community Home>Code and Documents>Code Exchange>Example Program Drafts
If you search for "Staroids", make sure you tell the search engine that you intended to spell it that way... it wants to autocorrect it.
Dave