Building TerraGear: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
(building template)
Line 35: Line 35:


Hopefully, you now have a working copy of the TerraGear tools, and are ready to [[ Using Terragear | use TerraGear]] to make scenery!
Hopefully, you now have a working copy of the TerraGear tools, and are ready to [[ Using Terragear | use TerraGear]] to make scenery!
{{Building}}


''If you are lost see [[Portal:User]] or [[Portal:Developer]]''
''If you are lost see [[Portal:User]] or [[Portal:Developer]]''
{{Building}}

Revision as of 16:35, 22 September 2008

Introduction

The terrain used in FlightGear -- the land over which one flies, its texturing (by land usage type), the rivers and lakes and so forth -- are generated by software from a sister project called TerraGear. TerraGear is used to read in geographical data -- descriptions of ground elevations, land cover (usage) information, airport locations and layouts, and so forth -- and output terrain over which one can fly.

For a variety of reasons, you might want to build terrain yourself, rather than downloading it from the available scenery on FlightGear. For instance, if you use TaxiDraw to modify/improve information about an airport's taxiway/apron layout, you might wish to see how that modified airport would look in the scenery before deciding you're happy with the results. And normally to see and use the airport in the scenery, it's necessary to submit the changes to Robin Peel, have him sign off on the changes, have the changes appear in the next official apt.dat, and then wait for the next official FlightGear scenery build; if you can build terrain yourself, you can start using it right away. Maybe the official scenery is too detailed for your slow machine, and you'd like to build terrain using a digital elevation model (DEM) with poorer resolution, to decrease the number of polygons and thus improve your framerates. Or maybe you've got a fantastically fast machine, and you want to build your own terrain using higher-resultion vector data (vmap1, Tiger) to get better roads/streams. For all these reasons, learning how to use TerraGear is a good idea.

There's existing documentation for TerraGear in at least three places: in the source code tree when you fetch it, on the website, and in the CVS tree for the website. The latter is the most current, and really needs to replace the version on the website; but all three are out of date in various ways. When I tried to use the most current documentation to use TerraGear, I ran into all sorts of problems: some I figured out on my own, and others various people helped me with (thanks especially Ralf and Frederic). I'm writing this stuff to detail what I had to do to use TerraGear to build scenery. I am not trying to rewrite the documentation; this should be considered an adjunct/supplement to the TerraGear docs, something you read along with the TerraGear docs. The docs can steer you wrong, or miss something; this is my effort to address those issues.

So here I'll describe what you have to do to get TerraGear up and running; a separate page details how to use TerraGear to build the terrain for a particular area. A word of caution, however: I use Linux, so this description will be Linux-centric. I hope instructions for other OSes will be similar, but I really don't know. In particular, I don't have easy access to a Windows machine, so I don't know how what I say will differ for those on Windows. In fact, I don't even know if TerraGear can be built/used on Windows. Hopefully it'll work, under directions not too different from here. If not, hopefully someone else will edit this page to clarify how to do it (if it's possible).

Building TerraGear

Go to the TerraGear website, select "CVS Resources", and check out a copy of the current sourcecode from CVS using the instructions at the top of the page. Once you've done that, you can try to build the source code. First, though, TerraGear depends on some other libraries you'll need. If you look in source/, you'll see a bunch of README files. Read them. In particular, note the ones with names like "README.somesoftwarename"; those describe software you'll need to be able to build and run TerraGear. Cygwin I ignored because that's for Windows and I'm not running Windows. plib and SimGear I already had from their CVS repositories, because I track FlightGear CVS; but it's a good idea to go ahead and update those two to current CVS, just in case the current TerraGear CVS depends on something that's been checked into plib or SimGear since the last time you updated them (yes, that means you'll have to update and rebuild FlightGear as well, sorry). If you don't track CVS for any of these things, you can still try to build TerraGear against whatever copies of SimGear and plib you have installed; but if you run into problems (unresolved symbols or whatever), that'd be the first place I'd look.

Some comments on the other libraries you need:

  • GPC. The instructions for what to do are in source/README.gpc. That file says the current version is 3.21; in fact, it's 3.22. Don't forget that editing step described in the README. When you run the makefile, it'll create a library called libgenpolyclip.a; make install will put it in /usr/local/lib/ or wherever else you want it to go.
  • GTS. I didn't build this -- I use Debian and got it by installing the Debian packages (libgts-0.7-1 and libgts-dev, both version 0.7.3-2 at this writing). So I can't comment on the instructions in source/README.gts.
  • newmat. This is a bunch of matrix manipulation utilities, it looks like. The file source/README.newmat tells you what to do, except for the fact that it sends you to the wrong webpage (an info page) to download the file you need. Once on that info page, to actually find the file you want to download, click on "to home page" near the top, then on the link for downloading files. You'll see links for newmat downloads (I downloaded the current newmat11). Once you've got it, just follow the step by step instructions in the source/README.newmat file.
  • nurbs++.

Once you have all of the above installed, you can proceed with configuring the TerraGear build, and building TerraGear. The TerraGear CVS Resources page that told you how to check out a copy of the source code tells you what to do to build it: run autogen.sh, then run configure, then make, then make install. However, first, autogen.sh comes out of CVS not-executable. So you'll need to make it executable first with chmod +x autogen.sh

Next, when you run configure, it takes arguments telling it where to find the libraries you need. I don't know what those arguments default to, but just for show, if they're all in /usr/local/lib, you could run configure like this: configure w/ args

$ ./configure --with-gts=/usr/local/lib/ --with-gpc=/usr/local/lib/ 
--with-newmat=/usr/local/lib/ --with-plib=/usr/local/lib/ 
--with-simgear=/usr/local/lib/  

Next comes running make to build all the executables. The instructions in source/README tell you that you want to "compile the /Libs/TriangleJRS code without optimization (-O2)". However, that's not the path to those files. Go to source/src/Lib/TriangleJRS. There, edit Makefile -- remove "-O2" from the two locations it appears (CFLAGS and CXXFLAGS).

At that point, you're ready to run "make", then "make install". Unless you gave an option to configure telling it that TerraGear should be installed somewhere other than /usr/local, you'll probably need to be root to do "make install" successfully.

I ran into no problems with the above -- everything built and installed OK. This was the most pain-free part of the whole experience.

Hopefully, you now have a working copy of the TerraGear tools, and are ready to use TerraGear to make scenery!

If you are lost see Portal:User or Portal:Developer