Canvas news: Difference between revisions

Jump to navigation Jump to search
1,417 bytes added ,  14 October 2022
Line 7: Line 7:
== 2022 ==
== 2022 ==
=== Releasing Canvas textures ===
=== Releasing Canvas textures ===
{{Stub}}
we'd need some kind
of way to delete the texture without deleting the window, redrawing the
texture when the window is reopened ? Starts to sound complicated … but on
the other hand, all windows on the Extra 500 use a custom Window class
which does something similar … <ref>https://sourceforge.net/p/flightgear/mailman/message/37719030/</ref>
I've updated the code to directly hide the window when the close button is
pressed, and also fixed a bug which consisted of the windows automatically
showing (which is not desired when the window is constructed at startup and
should only be shown later). New patch attached.
As for memory usage, I did a test - 100 1000x1000 px canvas windows, all
with destroy_on_close = 0. constructing them didn't give a significant
increase in memory usage - only upon showing them all at once, the RAM
usage went up by 2 GB. that's quite a lot you might say, but 1) most
dialogs are not as big as that and 2) which user opens 100 dialogs in one
session ? In most cases it won't be more than 10 = 200 MB RAM (if all
dialogs were using this new behaviour) - and the default behaviour is to
destroy the window on closing anyways (destroy_on_close = 1 by default, you
got to explicitly set it to 0 to get the new behaviour, also to maintain
backwards compatibility), so I think this won't be an issue.<ref>https://sourceforge.net/p/flightgear/mailman/message/37719123/</ref>
What we’d ideally want is a C++ change so that hidden canvases release their texture memory : it’s created the first time the canvas is rendered, which is why the memory is fine until you actually show them.
What we’d ideally want is a C++ change so that hidden canvases release their texture memory : it’s created the first time the canvas is rendered, which is why the memory is fine until you actually show them.


Navigation menu