I’ve started to experiment with Glide on a Cobra 1 with a 7-inch display. My application has many windows. Following the examples provided, I created/loaded all the windows and saved them in static properties of the Program class. After a while I ended up with out-of-memory errors. I examined the Glide code and realized that when a window is created an LCD-sized bitmap object is also created and stored along with the window in memory.
Digging a little deeper, I also realized that when a window becomes the current window (by setting the Glide.MainWindow property) the window’s bitmap is completely re-drawn and is copied to the LCD.
It seems to me that as long as all windows occupy the full screen there only needs to be one bitmap for the LCD, and all windows should draw their contents onto this single bitmap.
@ Skewworks - Thanks, but I don’t understand your answer ???
Does your “Nope” mean that it doesn’t work that way, or that it can’t work that way? I know that currently each window creates its own bitmap. My question is whether this is really necessary since only one bitmap can be shown at a time anyway, and since each window completely redraws its bitmap when it becomes the current window, having multiple bitmaps doesn’t save any processing time.
As for the reasoning behind a bitmap per screen; I think GHI did that from a performance standpoint. On switching from one screen to another (like with there screen animations) it definitely makes it faster for the CPU.
On my side of things I took the single screen approach to save resources. The trade of being when you switch screens, it has to render it a new. To do animations I allow for a background render to a separate bitmap.
Both approaches are valid. Working with micro-controllers you’re always performing a balancing act between speed and resources.
Glide was originally created as a GHI product and then released as open source. I am sure there are lots of opportunities for performance improvements in the code. I would not consider Glide as fully developed and optimized.