For example:
- Code: Select all
ca = canvas.new({"name": "Fuselage",
"size": [ca_size,ca_size],
"view": [ca_size,ca_size],
"mipmapping": 1});
...
ca.addPlacement({"node": "A__G91_fuselage_int.weapon.door.001"});
...
foreach(var image; [livery_001, dirty_001]) {
print("G91: set_livery.nas image: ",image," (",size(image),")");
# Insert the layer
ca_root = ca.createGroup();
if (size(image) > 0) {
layers_001[image] = ca_root.createChild("image")
.setFile(image)
.setSize(ca_size,ca_size);
if(image == dirty_001) {
if (dirty > 0.1) {
print("G91: set_livery.nas dirty show: ",dirty_001);
layers_001[image].show();
} else {
print("G91: set_livery.nas dirty hide: ",dirty_001);
layers_001[image].hide();
}
}
}
}
Once I've instantiated the livery ... I try to resize it, but I can not find a specific command to delete the canvas or resize it ...
I tried with this old canvas cancellation code:
- Code: Select all
if (ca != nil) {
layers_001 = {};
ca.del(nil);
}
Actually I can create a new canvas with the new dimension I want, but in reality I do not delete the canvas in GPU which then becomes zombies and therefore slows down the performances. The only solution, which seems to be fueling, is to recharge the plane (!?), But I have doubts that it is a good solution.
I could think of creating a canvas of 4096x4096 (maximum size of our liveries) and then change the resolution with a view, but obviously it does not change because the "view" is only a command to define the geometry and has no impact on the memory actually occupied in GPU:
- Code: Select all
ca = canvas.new({"name": "Fuselage",
"size": [ca_size,ca_size],
"view": [4,4],
"mipmapping": 1});
....
ca_root = ca.createGroup();
if (size(image) > 0) {
layers_001[image] = ca_root.createChild("image")
.setFile(image)
.setSize(4,4);
....
I notice that when I do I delete the old canvas to rebuild the new one with a different size ... the GPU starts to increase the load considerably ... a clear indication that you have performed an incorrect operation (which is natural if the instanted canvas object does not manages, in this case, the method of () ...)
I hope that some of you know a solution to this problem.
This is an example of the slowdown of the GPU when changing the resolution of the canvas with the method of destruction and reconstruction of the canvas with a different size:
Start 4096
change 2048
change 1024
etc ...
The GPU is NVIDIA 1080 with 8 GB VRAM and the system is Intel I7-8700K @ 3.7 GHZ 25 GB RAM - SO: Ubuntu 18.10
FGFS version is 2018.4
Note: The effect of dark fuselage is at the end of the first resizing attempt, if you make another resizing with the same resolution, the correct image appears.