Board index FlightGear Development Canvas

Is it possible to use Canvas in non-flightgear projects?

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.

Is it possible to use Canvas in non-flightgear projects?

Postby bleriot » Thu Nov 29, 2012 8:30 am

Hi to everybody.

First of all, thanks to the developers of flightgear for this wonderful, open-source piece of software engineering!

I'm a developer / engineer and an enthusiastic flightsimmer. I've been "flying" with flightgear and other simulators for more than five years now.

Now I'm interested in developing an application that could benefit from flightgear's team long experience. And this I why I contact you.

The idea is to develop a real RC model including some sensors capturing information about attitude, position, velocity... and send all this data wirelessly to a ground station, that should display it on screen.

I know how much effort has to be spent in designing and programming a good GUI, so I wonder if it could be possible to use Canvas as a standalone component (I mean, with no integration with flightgear) that I would integrate with the rest of the software developed for this ground station.

Would this be possible? Or is Canvas too deeply coupled with flightgear as to be used in a standalone way?

Depending on your answer, I would make more questions later, but I think that these would be spurious now if it is not possible to use Canvas the way I need.

Thank you very much again for your effort, time and interest.

Bleriot.
bleriot
 
Posts: 1
Joined: Thu Nov 29, 2012 8:17 am

Re: Is it possible to use Canvas in non-flightgear projects?

Postby Hooray » Thu Nov 29, 2012 8:55 am

bleriot wrote in Thu Nov 29, 2012 8:30 am:I know how much effort has to be spent in designing and programming a good GUI, so I wonder if it could be possible to use Canvas as a standalone component (I mean, with no integration with flightgear) that I would integrate with the rest of the software developed for this ground station.

Just recently, Tom (the main Canvas developer) has refactored the canvas system such that it can be more easily re-used in other programs, this included moving the Canvas component from FlightGear to SimGear and releasing his code under SimGear's license (LGPL).

Would this be possible? Or is Canvas too deeply coupled with flightgear as to be used in a standalone way?


Yes, it is now possible, but you will obviously benefit from using certain FlightGear-related technologies, such as an 1) SGSubsystem-based main loop, 2) an osgviewer-based main window, and 3) Nasal scripting.
Icecode's FGRadar project is such a completely separate code base from FG, which uses SG/FG components to simplify code reuse, without re-inventing the wheel.

For this very purpose, FGRadar uses a custom "SGApplication" framework - so that existing FlightGear subsystems can be more easily reused in different projects.
All that's needed is deriving your own class from "SGApplication" and implementing its interface.
The whole idea behind "SGApplication" is to provide a scriptable framework for OpenGL applications, fully based on 1) OSG, 2) SGSubsystems, 3) Nasal scripting and 4) the Canvas.

For details see: http://wiki.flightgear.org/FGRadar
For source code see: https://gitorious.org/fgradar/fgradar/t ... imgear/app

To see how the SGApplication source code is used, see: https://gitorious.org/fgradar/fgradar/t ... r/src/main

At the moment, this doesn't currently include any Canvas support yet, because of the progress made by the OpenRadar project recently.
So what needs to be done is detailed at: http://wiki.flightgear.org/FGRadar#Canvas_Integration

But basically, all that's needed is taking existing subsystems from FG/SG and integrating them into SGApplication.
This is what's currently done for the scripting part of "SGApplication", so that SGApplication is fully scriptable via Nasal.

If you know C++ and if you know your way around the SG/FG code bases, extending SGApplication to add canvas support is not a big thing actually.
Your own application would then ideally be derived from SGApplication so that it can easily make use of existing FG/SG subsystems.

BTW: Tom is fully supportive of the idea to use the canvas in other projects, FG related or not.

Note that "FGRadar" is currently not really ATC specific at all, so once SGApplication has canvas support, we are almost done writing "FGCanvas" from scratch actually: http://wiki.flightgear.org/FGCanvas
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11968
Joined: Tue Mar 25, 2008 8:40 am


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest