Board index FlightGear Development Canvas

canvas placement  Topic is solved

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

canvas placement

Postby F-JYL » Wed Dec 18, 2013 6:03 am

Hello,

There is something I do not understand with canvas placement, I try to place an svg, should replace the texture, but it display only a part of it.
svg is 1024 X 1024, a texture exists ....
Image
As you can see, correctly displayed in the dialog but not in the instrument panel. What should I check ?
Code: Select all
var mfd = {};
var mfdDisplay = {};

var mfdCreated = 0;

setlistener("sim/signals/fdm-initialized", func {
   if (mfdCreated == 1)
      mfd.del();
   mfd = canvas.new({
      "name": "MFD",
      "size": [1024, 1024],
      "view": [1024, 1024],
      "mipmapping": 1
   });
   mfd.addPlacement({"node": "LEICAS.screen"});
   
   var group = mfd.createGroup();
   mfdDisplay = canvas_fcs.new(group);
   mfdDisplay.update();
   mfdCreated = 1;
   print("777 mfd created");
});

var showMfd = func() {
   var dlg = canvas.Window.new([400, 400], "dialog");
   dlg.setCanvas(mfd);
}
F-JYL
 
Posts: 54
Joined: Mon Mar 11, 2013 8:34 pm
Callsign: F-JYL
Version: git
OS: Ubuntu 13.10

Re: canvas placement

Postby F-JYL » Wed Dec 18, 2013 7:09 pm

When I place it over ND.screenL, display is correct, but I cannot see the difference between these two objects in ac files.
F-JYL
 
Posts: 54
Joined: Mon Mar 11, 2013 8:34 pm
Callsign: F-JYL
Version: git
OS: Ubuntu 13.10

Re: canvas placement

Postby TheTom » Wed Dec 18, 2013 10:20 pm

They should show the same thing. Maybe the texture mapping does not use the full 0.0-1.0 range?
TheTom
 
Posts: 321
Joined: Sun Oct 09, 2011 10:20 am

Re: canvas placement

Postby F-JYL » Thu Dec 19, 2013 5:37 am

I cannot see the difference between the two objects
Working object ND.screenR
Code: Select all
OBJECT poly
name "ND.screenR"
loc 0.00010915 0.000183625 -7.575e-06
texture "screen.png"
crease 30.000000
numvert 4
0.00207385 0.0966435 0.0962132
0.00207385 -0.0896657 0.0962132
0.00207385 -0.0896657 -0.096501
0.00207385 0.0966435 -0.096501
numsurf 1
SURF 0x0
mat 2
refs 4
3 1.00067 0.999407
0 4.45843e-05 0.999407
1 4.45843e-05 0.000756443
2 1.00067 0.000756443
kids 0


Not working Leicas.screen
Code: Select all
OBJECT poly
name "LEICAS.screen"
loc 4.65661e-10 0.000114778 0.000574058
texture "screen.png"
crease 45.000000
numvert 4
0.002 -0.10173 0.10158
0.002 0.0943849 0.10158
0.002 0.0943849 -0.101277
0.002 -0.10173 -0.101277
numsurf 1
SURF 0x0
mat 1
refs 4
0 0.0917969 -0.00390631
3 0.900391 -0.00390631
2 0.900391 0.757812
1 0.0917969 0.757812
kids 0
F-JYL
 
Posts: 54
Joined: Mon Mar 11, 2013 8:34 pm
Callsign: F-JYL
Version: git
OS: Ubuntu 13.10

Re: canvas placement  

Postby Gijs » Thu Dec 19, 2013 8:56 am

The 4 rows of numbers below "ref 4" define the mapping of the texture. The working version maps to the full 0 to 1 range (rounding errors are very small), while the lower variant maps to something like 0 to 0.9 (and something in between).

Try changing the 0.75 and 0.9 to 1.0 and the others to 0.
Airports: EHAM, EHLE, KSFO
Aircraft: 747-400
User avatar
Gijs
Moderator
 
Posts: 9386
Joined: Tue Jul 03, 2007 2:55 pm
Location: Amsterdam/Delft, the Netherlands
Callsign: PH-GYS
Version: Git
OS: Windows 10

Re: canvas placement

Postby F-JYL » Fri Dec 20, 2013 7:21 am

You are right that's exactly the problem, thank you for the info. I still have to learn how to use blender to be able to adjust the mapping....
F-JYL
 
Posts: 54
Joined: Mon Mar 11, 2013 8:34 pm
Callsign: F-JYL
Version: git
OS: Ubuntu 13.10


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest