Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Difference between revisions of "Building FlightGear with osgEarth Integration"

From FlightGear wiki
Jump to: navigation, search
m (http://forum.flightgear.org/viewtopic.php?f=47&t=23286&p=212573#p212573)
(related content)
 
(13 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Stub}}
+
{{incomplete}}
  
{{Note|This article contains outdated instructions still referring to the 2.12 integration branches. Meanwhile, those branches have been updated for 3.x - and developers are exploring the possibility to get this committed into mainline for the upcoming 3.2 release.
+
{{forum|81|OsgEarth support in FlightGear}}
  
These should be the public links to the flightgear / osgEarth repositories (note that latest development is found in OsgEarthNext branch)
+
{{Note|Development of FlightGear osgEarth integration takes place in separate repositories.
* git clone -v -b OsgEarthNext git://gitorious.org/fg/simgear-osgearth.git simgear
+
* git clone -v -b OsgEarthNext git://gitorious.org/fg/flightgear-osgearth.git flightgear
+
* git clone -v -b OsgEarthNext git://gitorious.org/fg/fgdata-osgearth.git fgdata
+
* git clone -v -b OsgEarthNext git://gitorious.org/fg/fgrun-osgearth.git fgrun
+
  
Use this version of osgEarth:
+
Updated branches for FG 2016.2.0: '''2016.2.0-OsgEarth'''
* git clone -v -b OsgEarthNext https://github.com/poweroftwo/osgearth.git osgearth
+
  
 +
The repositories for simgear- and flightgear- osgEarth are on:
 +
* https://gitlab.com/users/poweroftwo/projects
 +
 +
The corresponding fgdata is at:
 +
* https://bitbucket.org/simperative/fgdata/
 +
 +
I noticed some run-time issues, see below: [[#Run-time issues / missing features]]<br/>
 +
Main FG Scenery development seems to go in other directions, also see below: [[#Related content]]
 
}}
 
}}
 +
 +
<!--
 +
{{FGCquote
 +
  |This is yet another auto-builder for Flightgear and for the time being specific to '''Windows 64bit ONLY'''.  It is particularly geared toward building FG with the latest incarnation of the osgEarth integration.  The simple minded script attempts to download all needed and hopefully manages conflicts with your user/system environment variables properly.  Also, a minimal sized fgdata is downloaded as a starting point.<br/>
 +
<br/>
 +
It is a work in progress and will be refined over time.  Hopefully Linux and Mac versions will follow.  It is proves to work well, I plan to update the wiki.  <br/>
 +
<br/>
 +
[Special thanks to Alant for doing early testing]<br/>
 +
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=213447#p213447
 +
    |title=<nowiki>auto-builder for Flightgear / osgEarth build</nowiki>
 +
    |author=<nowiki>poweroftwo</nowiki>
 +
    |date=<nowiki>Wed Jun 25</nowiki>
 +
  }}
 +
}}
 +
 +
}}
 +
-->
  
 
== Objective ==
 
== Objective ==
  
== Assumptions ==
+
{{out of date|category=section}}
* You already have working branches of SG/FG and FGData, you only need to add the simperative branches as remote tracking branches
+
 
* $SG_SRC, $FG_SRC and $FG_ROOT must be clean checkouts, commit/stash any unsaved work and check out next/master first.
+
{{FGCquote
 +
  |Someone able to build from source should still be able to get osgEarth working without too much effort - on Windows there should even be some kind of "overlay" (set of patch files) - I am not sure if those have recently been updated for 3.2 though.
 +
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=228406#p228406
 +
    |title=<nowiki>Re: 3.2 </nowiki>
 +
    |author=<nowiki>Hooray</nowiki>
 +
    |date=<nowiki>Tue Dec 30</nowiki>
 +
  }}
 +
}}
 +
 
 +
{{FGCquote
 +
  |you do need osgEarth support for that, which is not included in any of the standard releases so far - which is why you need to follow the instructions from the osgEarth thread - however, osgEarth in 3.2 is a completely different matter, because this may very well involve building FlightGear from source - all of this is fairly well documented via a number of different wiki articles. However, it is a fairly technical and tedious process, certainly for people new to compiling software. In other words, osgEarth support in FlightGear in its current form hasn't yet been included in any official release, which means that it must be considered an experimental feature, which is primarily supported by the community, through a number of wiki articles, forum threads/postings and instructions on getting it to work.
 +
  |{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=228441#p228441
 +
    |title=<nowiki>Re: 3.2 </nowiki>
 +
    |author=<nowiki>Hooray</nowiki>
 +
    |date=<nowiki>Tue Dec 30</nowiki>
 +
  }}
 +
}}
 +
 
 +
{{FGCquote
 +
  |I believe that the OsgEarthNext branch can be built in Linux but seems to require some gyrations to accomplish the setup. [...]
 +
If you have the fgdata git repository cloned already, you might consider adding a remote pointing to the fgdata-osgearth repository.  That would allow you to cleanly manage as a separate branch.|{{cite web |url=http://forum.flightgear.org/viewtopic.php?p=228114#p228114
 +
    |title=<nowiki>Re: Initial FlightGear / </nowiki>
 +
    |author=<nowiki>poweroftwo</nowiki>
 +
    |date=<nowiki>Fri Dec 26</nowiki>
 +
  }}
 +
}}
 +
 
 +
== Status ==
 +
 
 +
{{FGCquote
 +
|1= It is what it is, and being what it is (a set of external patches), it has a certain barrier to entry, and learning curve, associated with it.
 +
 
 +
Basically, people wanting to use this, will need to know how to build FlightGear from source, how to use git and how to apply patches.
 +
 
 +
People with a working build environment should have no problems getting this to work - the main caveat being currently that some recent sg/fg developments would not be integrated yet.
 +
But otherwise, all the documentation that you can find on the wiki about building FlightGear from source, using git, will be applicable - the main difference is that once you have everything set up and working to build stock fgfs, you would add poweroftwo's gitlab branches as git remotes, and then build an older version of SimGear/FlightGear which contains the corresponding patches.
 +
|2= {{cite web
 +
  | url    = http://forum.flightgear.org/viewtopic.php?p=276880#p276880
 +
  | title  = <nowiki>Re: 3.2 osgearth or other integrated real time satellite dat</nowiki>
 +
  | author = <nowiki>Hooray</nowiki>
 +
  | date  = Feb 20th, 2016
 +
  | added  = Feb 20th, 2016
 +
  | script_version = 0.25
 +
  }}
 +
}}
 +
 
 +
{{FGCquote
 +
  |That's basically the whole idea behind osgEarth. It can do satellite/orthoimagery (that's what you see advertised the most), but it can also load shapefiles, DEM etc. And it even comes with built-in LOD algorithms. See their Google+ page for some recent screenshots and videos: https://plus.google.com/+OsgearthOrg/posts<br/>
 +
Jeff has done/is doing excellent working integrating it to FlightGear. I'd definitely encourage anyone interested in generating scenery on the fly to look into that before anything else.|{{cite web |url=http://sourceforge.net/p/flightgear/mailman/message/33596851/
 +
    |title=<nowiki>Re: [Flightgear-devel] Google Code closing down</nowiki>
 +
    |author=<nowiki>Gijs de Rooy</nowiki>
 +
    |date=<nowiki>2015-03-14</nowiki>
 +
  }}
 +
}}
 +
 
 +
== Building on Linux (Arch Linux) ==
 +
''Updated as of 2016-12-09''
 +
 
 +
While I am using Arch Linux the build instructions should also be applicable on other GNU/Linux distributions.
 +
 
 +
Note however that this feature should still be considered experimental. The build process can be tedious and things may not work as expected.
 +
 
 +
In case you never build FG from source you may try to build the regular version first. Understanding what you're doing should greatly help in getting this to work.
 +
 
 +
{{FGCquote|
 +
people definitely need to understand what they are doing, I would not suggest to actually try this unless people really understand how to patch/build different versions of SG/FG - people blindly following instructions by copying &amp; pasting shell commands into a terminal window is begging for trouble - as matter of fact, that is why I always encourage folks to set up dedicated "fgfs" accounts to be on the safe side.|{{cite web
 +
  |url    =  https://forum.flightgear.org/viewtopic.php?p=300144#p300144
 +
  |title  =  <nowiki> Re: OSGEarth integrate in Linux Ubuntu </nowiki>
 +
  |author =  <nowiki> Hooray </nowiki>
 +
  |date  =  Nov 29th, 2016
 +
  |added  =  Nov 29th, 2016
 +
  |script_version = 0.39
 +
  }}
 +
}}
 +
 
 +
=== Prerequisites ===
 +
 
 +
All that is needed to build regular FlightGear from source.
 +
 
 +
See e.g.:
 +
 
 +
* http://wiki.flightgear.org/Building_FlightGear_-_Linux
 +
* http://wiki.flightgear.org/Building_FlightGear_-_Debian
 +
 
 +
I used OpenSceneGraph 3.4.0, installed via package manager.
 +
 
 +
Additionally:
 +
 
 +
* gdal
 +
* curl
 +
* proj
 +
* evtl. more ?? (check the configure outputs)
 +
 
 +
Below instructions will use a directory inside the user's home. So it does not conflict with system-wide installed packages.
 +
 
 +
Create a directory for the build process inside your home:
 +
 
 +
<pre>$ mkdir FG-osgE
 +
$ mkdir FG-osgE/local  # (install dir)
 +
$ cd FG-osgE</pre>
 +
 
 +
=== osgEarth ===
 +
 
 +
Due to a change not yet adapted in simgear-osgearth, the master branch cannot be used currently. Sticking to a specific version would be useful anyway, so I used the tag <code>osgearth-2.8</code>.
 +
 
 +
For this to work, in turn, a commit in simgear-osgearth has to be reverted in the next step. (This situation is not optimal and should be improved.)
 +
 
 +
<pre>$ git clone https://github.com/gwaldron/osgearth.git
 +
$ cd osgearth/
 +
$ git checkout -b osgearth-2.8 osgearth-2.8
 +
 
 +
$ mkdir ../osgearth-build
 +
$ cd ../osgearth-build
 +
$ cmake ../osgearth -DCMAKE_INSTALL_PREFIX=&quot;$HOME/FG-osgE/local&quot;
 +
$ make -jN
 +
$ make install
 +
$ cd ..</pre>
 +
With N being the number of CPU's you want to use, e.g.:
 +
 
 +
<pre>$ make -j3</pre>
 +
=== simgear-osgearth ===
 +
 
 +
<pre>$ git clone https://gitlab.com/poweroftwo/simgear-osgearth.git
 +
$ cd simgear-osgearth
 +
$ git checkout 2016.2.0-OsgEarth</pre>
 +
Branch is at commit: <code>0f2bc916f3d4739adc3efe961c9e313ce4b388e7</code><br />
 +
Since we use osgEarth-2.8 we need to revert an API change commit.
 +
 
 +
<pre>$ git revert 8777ad51e2ebc3ba5b55112e391e99504bb5d079
 +
 
 +
(Save the log.)
 +
 
 +
$ mkdir ../simgear-osgearth-build
 +
$ cd ../simgear-osgearth-build
 +
$ cmake ../simgear-osgearth -DCMAKE_INSTALL_PREFIX=&quot;$HOME/FG-osgE/local&quot;
 +
$ make -jN
 +
$ make install
 +
$ cd ..</pre>
 +
 
 +
=== flightgear-osgearth ===
 +
 
 +
<pre>$ git clone https://gitlab.com/poweroftwo/flightgear-osgearth.git
 +
$ cd flightgear-osgearth
 +
$ git checkout 2016.2.0-OsgEarth
 +
$ mkdir ../flightgear-osgearth-build
 +
$ cd ../flightgear-osgearth-build
 +
$ SIMGEAR_DIR=&quot;$HOME/FG-osgE/local&quot; cmake ../flightgear-osgearth -DCMAKE_INSTALL_PREFIX=&quot;$HOME/FG-osgE/local&quot;
 +
$ make install
 +
$ cd ..</pre>
 +
I had to correct the gdal includes in <code>src/Viewer/OsgEarthHeightField.cxx</code> and add <code>-DCMAKE_EXE_LINKER_FLAGS=&quot;-lgdal&quot;</code> to the cmake command, but that might be an Arch specific problem.<ref>I found this solution on a french forum: http://fr.flightgear.org/forums/viewtopic.php?id=3383&p=3
 +
</ref>
 +
 
 +
Though I cannot find gdal in the CMakeLists.txt so it would evtl. be good/necessary to add it there (probably not that easy).
 +
 
 +
=== fgdata-osgearth ===
 +
 
 +
Clone or download from https://bitbucket.org/simperative/fgdata.
 +
 
 +
<pre>$ git clone https://bitbucket.org/simperative/fgdata.git
 +
$ cd fgdata
 +
$ git fetch &amp;&amp; git checkout 2016.2.0-OsgEarth</pre>
 +
 
 +
=== Launch ===
 +
 
 +
Commands or a script, e.g.:
 +
 
 +
<pre>#!/bin/bash
 +
#
 +
#
 +
export LD_LIBRARY_PATH=&quot;$HOME/FG-osgE/local/lib64&quot;
 +
export FG_ROOT=&quot;$HOME/FG-osgE/fgdata&quot;
 +
export FG_HOME=&quot;$HOME/.fgfs-osgE&quot;
 +
 
 +
local/bin/fgfs</pre>
 +
 
 +
Activate osgEarth via the menu ''View --> Rendering Options --> osgEarth''.
 +
 
 +
=== Run-time issues / missing features ===
  
== Building the osgEarth plugin ==
+
* landing lights are misplaced (in the air) on KSFO (others?)
* clone the repository: <pre>git clone -v -b 2.12-OsgEarthIntegration git@gitorious.org:fg/flightgear-osgearth.git flightgear</pre>
+
* metar data not available (probably easy to fix, maybe something like a wrong url?)
* create a separate build directory
+
* terrain is always lit up (though brightness can be set manually)
* configure via CMake, set '''-DCMAKE_INSTALL_PREFIX''' matching your OSG/SG/FG installation path (not needed if you installed OSG/SG system-wide)
+
* aircraft may sink into ground when switching to osgEarth
* run "make install" (to run a parallel build, pass '''-j x''', where is x the number of cores available/to be used)
+
* next, build SimGear
+
  
== SimGear ==  
+
== Related content ==
Switch into your cloned SimGear repository, make sure that it is in a clean state (commit/stash any changes, switch to next)
+
<pre>
+
## add a new remote alias
+
git remote add simperative  git@gitorious.org:fg/simgear-osgearth.git
+
  
## fetch all branches
+
Main FG Scenery development seems to go in other directions. It might take some time till the next release though.
git fetch simperative
+
  
## check out a remote tracking branch named topics/osgearth
+
* [[TerraGear_roadmap]]
git checkout --track -b topics/osgearth simperative/2.12-OsgEarthIntegration
+
* https://forum.flightgear.org/viewtopic.php?f=5&t=29693 Next-generation scenery generating?
</pre>
+
  
* run '''make -j4 install'''
+
Also there is interesting OSM (openstreetmap) stuff going on, you may want to check out.
* switch to your FG_SRC directory
+
  
== FlightGear ==
+
* [[OpenStreetMap]]
Switch into your cloned FlightGear repository, make sure that it is in a clean state (commit/stash any changes, switch to next)
+
<pre>
+
git remote add simperative  git@gitorious.org:fg/flightgear-osgearth.git
+
git fetch simperative
+
git checkout --track -b topics/osgearth simperative/2.12-OsgEarthIntegration
+
</pre>
+
  
== FGData ==
+
== References ==
  
<pre>
+
<references />
git remote add simperative git@gitorious.org:fg/fgdata-osgearth.git
+
git fetch simperative
+
git checkout --track -b topics/osgearth simperative/2.12-OsgEarthIntegration
+
</pre>
+
  
[[Category:Core developer documentation]]
+
[[Category:Building from source]]
 
[[Category:Core development projects]]
 
[[Category:Core development projects]]

Latest revision as of 12:13, 9 December 2016

This article is incomplete. Please help improve the article, or discuss the issue on the talk page.
Note  Development of FlightGear osgEarth integration takes place in separate repositories.

Updated branches for FG 2016.2.0: 2016.2.0-OsgEarth

The repositories for simgear- and flightgear- osgEarth are on:

The corresponding fgdata is at:

I noticed some run-time issues, see below: #Run-time issues / missing features
Main FG Scenery development seems to go in other directions, also see below: #Related content


Objective

This section contains out-of-date information

Please help improve this article by updating it. There may be additional information on the talk page.

Cquote1.png Someone able to build from source should still be able to get osgEarth working without too much effort - on Windows there should even be some kind of "overlay" (set of patch files) - I am not sure if those have recently been updated for 3.2 though.
— Hooray (Tue Dec 30). Re: 3.2 .
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png you do need osgEarth support for that, which is not included in any of the standard releases so far - which is why you need to follow the instructions from the osgEarth thread - however, osgEarth in 3.2 is a completely different matter, because this may very well involve building FlightGear from source - all of this is fairly well documented via a number of different wiki articles. However, it is a fairly technical and tedious process, certainly for people new to compiling software. In other words, osgEarth support in FlightGear in its current form hasn't yet been included in any official release, which means that it must be considered an experimental feature, which is primarily supported by the community, through a number of wiki articles, forum threads/postings and instructions on getting it to work.
— Hooray (Tue Dec 30). Re: 3.2 .
(powered by Instant-Cquotes)
Cquote2.png
Cquote1.png I believe that the OsgEarthNext branch can be built in Linux but seems to require some gyrations to accomplish the setup. [...] If you have the fgdata git repository cloned already, you might consider adding a remote pointing to the fgdata-osgearth repository. That would allow you to cleanly manage as a separate branch.
— poweroftwo (Fri Dec 26). Re: Initial FlightGear / .
(powered by Instant-Cquotes)
Cquote2.png

Status

Cquote1.png It is what it is, and being what it is (a set of external patches), it has a certain barrier to entry, and learning curve, associated with it.

Basically, people wanting to use this, will need to know how to build FlightGear from source, how to use git and how to apply patches.

People with a working build environment should have no problems getting this to work - the main caveat being currently that some recent sg/fg developments would not be integrated yet.

But otherwise, all the documentation that you can find on the wiki about building FlightGear from source, using git, will be applicable - the main difference is that once you have everything set up and working to build stock fgfs, you would add poweroftwo's gitlab branches as git remotes, and then build an older version of SimGear/FlightGear which contains the corresponding patches.
Cquote2.png
Cquote1.png That's basically the whole idea behind osgEarth. It can do satellite/orthoimagery (that's what you see advertised the most), but it can also load shapefiles, DEM etc. And it even comes with built-in LOD algorithms. See their Google+ page for some recent screenshots and videos: https://plus.google.com/+OsgearthOrg/posts
Jeff has done/is doing excellent working integrating it to FlightGear. I'd definitely encourage anyone interested in generating scenery on the fly to look into that before anything else.
— Gijs de Rooy (2015-03-14). Re: [Flightgear-devel] Google Code closing down.
(powered by Instant-Cquotes)
Cquote2.png

Building on Linux (Arch Linux)

Updated as of 2016-12-09

While I am using Arch Linux the build instructions should also be applicable on other GNU/Linux distributions.

Note however that this feature should still be considered experimental. The build process can be tedious and things may not work as expected.

In case you never build FG from source you may try to build the regular version first. Understanding what you're doing should greatly help in getting this to work.

Cquote1.png people definitely need to understand what they are doing, I would not suggest to actually try this unless people really understand how to patch/build different versions of SG/FG - people blindly following instructions by copying & pasting shell commands into a terminal window is begging for trouble - as matter of fact, that is why I always encourage folks to set up dedicated "fgfs" accounts to be on the safe side.
— Hooray  (Nov 29th, 2016).  Re: OSGEarth integrate in Linux Ubuntu .
(powered by Instant-Cquotes)
Cquote2.png

Prerequisites

All that is needed to build regular FlightGear from source.

See e.g.:

I used OpenSceneGraph 3.4.0, installed via package manager.

Additionally:

  • gdal
  • curl
  • proj
  • evtl. more ?? (check the configure outputs)

Below instructions will use a directory inside the user's home. So it does not conflict with system-wide installed packages.

Create a directory for the build process inside your home:

$ mkdir FG-osgE
$ mkdir FG-osgE/local   # (install dir)
$ cd FG-osgE

osgEarth

Due to a change not yet adapted in simgear-osgearth, the master branch cannot be used currently. Sticking to a specific version would be useful anyway, so I used the tag osgearth-2.8.

For this to work, in turn, a commit in simgear-osgearth has to be reverted in the next step. (This situation is not optimal and should be improved.)

$ git clone https://github.com/gwaldron/osgearth.git
$ cd osgearth/
$ git checkout -b osgearth-2.8 osgearth-2.8

$ mkdir ../osgearth-build
$ cd ../osgearth-build
$ cmake ../osgearth -DCMAKE_INSTALL_PREFIX="$HOME/FG-osgE/local"
$ make -jN
$ make install
$ cd ..

With N being the number of CPU's you want to use, e.g.:

$ make -j3

simgear-osgearth

$ git clone https://gitlab.com/poweroftwo/simgear-osgearth.git
$ cd simgear-osgearth
$ git checkout 2016.2.0-OsgEarth

Branch is at commit: 0f2bc916f3d4739adc3efe961c9e313ce4b388e7
Since we use osgEarth-2.8 we need to revert an API change commit.

$ git revert 8777ad51e2ebc3ba5b55112e391e99504bb5d079

(Save the log.)

$ mkdir ../simgear-osgearth-build
$ cd ../simgear-osgearth-build
$ cmake ../simgear-osgearth -DCMAKE_INSTALL_PREFIX="$HOME/FG-osgE/local"
$ make -jN
$ make install
$ cd ..

flightgear-osgearth

$ git clone https://gitlab.com/poweroftwo/flightgear-osgearth.git
$ cd flightgear-osgearth
$ git checkout 2016.2.0-OsgEarth
$ mkdir ../flightgear-osgearth-build
$ cd ../flightgear-osgearth-build
$ SIMGEAR_DIR="$HOME/FG-osgE/local" cmake ../flightgear-osgearth -DCMAKE_INSTALL_PREFIX="$HOME/FG-osgE/local"
$ make install
$ cd ..

I had to correct the gdal includes in src/Viewer/OsgEarthHeightField.cxx and add -DCMAKE_EXE_LINKER_FLAGS="-lgdal" to the cmake command, but that might be an Arch specific problem.[1]

Though I cannot find gdal in the CMakeLists.txt so it would evtl. be good/necessary to add it there (probably not that easy).

fgdata-osgearth

Clone or download from https://bitbucket.org/simperative/fgdata.

$ git clone https://bitbucket.org/simperative/fgdata.git
$ cd fgdata
$ git fetch && git checkout 2016.2.0-OsgEarth

Launch

Commands or a script, e.g.:

#!/bin/bash
#
#
export LD_LIBRARY_PATH="$HOME/FG-osgE/local/lib64"
export FG_ROOT="$HOME/FG-osgE/fgdata"
export FG_HOME="$HOME/.fgfs-osgE"

local/bin/fgfs

Activate osgEarth via the menu View --> Rendering Options --> osgEarth.

Run-time issues / missing features

  • landing lights are misplaced (in the air) on KSFO (others?)
  • metar data not available (probably easy to fix, maybe something like a wrong url?)
  • terrain is always lit up (though brightness can be set manually)
  • aircraft may sink into ground when switching to osgEarth

Related content

Main FG Scenery development seems to go in other directions. It might take some time till the next release though.

Also there is interesting OSM (openstreetmap) stuff going on, you may want to check out.

References

  1. I found this solution on a french forum: http://fr.flightgear.org/forums/viewtopic.php?id=3383&p=3