FlightGear

FlightGear is a GPL'd flight simulator that might be useful for Soft Walls.
  • Using Virtual Playa models inside Sketchup
  • vterrain.org - good overview of the various flight simulators.
  • http://terragear.org/ used to generate scenery
  • http://fgsd.sourceforge.net/ Used to add static objects
  • fgsd-0.2.1.tar.gz
  • gts fgsd-0.2.1 requires gts-0.7.1.tar.gz (configure complains)
  • glib-1.2.8.tar.gz
  • fltk 2.0 CVS Version
  • Start up Cygwin setup.exe and install jpeg, libjpeg62, libjpeg6b
  • Using the Virtual Playa models in FlightGear

    9/11/05

    Virtual Playa (http://www.virtualplaya.org) has Microsoft Flight Simulator models of various Burning Man (http://www.burningman.com) structures.

    Virtual Playa Resources

  • http://www.virtualplaya.org
  • Virtual Playa Tribe
  • Andrew Johnstone - original creator of many of the Virtual Playa models.
  • Daniel Terdiman's January 05, 2004 article in Wired: Burning Man, the Simulation

  • The Microsoft Flight Simulator Models are in .bgl files. We extended a bgl converted for Pretty Poly Editor (PPE, http://prettypoly.sourceforge.net) and converted the Virtual Playa objects to a format suitable for FlightGear.

    NOTE: The following objects do not work 2003man, 2003honor, centercampl, centercamp2. I think the reason these objects do not works is because they have more than 32767 vertices, which is more than will fit in a short.

    Quick Start

    Converting the .bgl files to .ssg files is covered below. Here, we cover how to get the models into the Windows port of FlightGear.
    1. Download the Windows installer of FlightGear from http://www.flightgear.org/Downloads/ and install it. In August, 2005, I used FlightGear 0.9.8.
    2. Download the generic scenery for the Gerlach region, which is located in the w120n40 file, which is available from http://www.flightgear.org/Downloads/scenery.html
    3. Use the FlightGear Scenery Installer (Start -> All Programs -> FlightGear v 0.9.8 -> Install & Uninstall Scenery) to install the scenery
      For more information about Scenery, see also http://www.flightgear.org/Docs/FAQ.shtml#2.6
      August, 2005: Under FlightGear 0.9.8, install the scenery file so it appears at c:/Program Files/FlightGear/Scenery/w120n40/w120n40.
    4. Now is a good time to verify that FlightGear works.
      1. Start up the FlightGear Launcher: Start -> All Programs -> FlightGear v 0.9.8 -> FlightGear Launcher
      2. I find it easier to fly the UFO because it does not stall and can hover; so, select UFO from the 'White Project' of the UNESCO
      3. It does not matter what airport you select (Eventually, we should have the BRC strip there)
      4. In the next screen, click on Advanced -> Initial Position and fill in:
             Longitude: -119.23
             Latitude:  40.75  
             
      5. Click on "OK" and the "Run"
      6. After the FlightGear Splash Screen, you should see the Playa (sans Burning Man).
      7. To Move, enable the numeric keypad by hitting Num Lock and then type 9 on the numeric keypad. On some keyboards, you may need to type Shift-9
        This will get you moving.
      8. To steer, use the arrow keys.
        For more information, see the FlightGear documentation at http://www.flightgear.org/docs.html
    5. Now we are ready to try introducing the Burning Man scenery.
    6. Download the .ssg files and the bitmaps.

      Note that because of a bug in plib, we flipped the bitmaps and provide them in tar file.

    7. October 2005:

      http://ptolemy.eecs.berkeley.edu/~cxh/sapub/2005_VPlaya_Scenery_0828_flightgear_flipped_1002.tar.gz Use This One

    8. Older version:

      http://ptolemy.eecs.berkeley.edu/~cxh/sapub/virtual_playa_1.2_addons_flipped_flightgear.tar.gz Available only for historical reasons

    9. Untar the file in a temporary directory.
    10. Copy the .bmp files to the top level directory of FlightGear:
      cp *.bmp c:/Program\ Files/FlightGear
      
    11. Copy the .ssg and .stg files to the appropriate directory
      Flightgear 0.9.8: c:/Program Files/FlightGear/scenery/w120n40/w120n40
      Flightgear 0.9.6: c:/Program Files/FlightGear/data/Scenery/Objects/w120n40/w120n40

      For example:

      cp *.ssg *.stg c:/Program\ Files/FlightGear/scenery/w120n40/w120n40
      

      The tar file contains 991419.stg which tells FlightGear where to locate the Burning Man objects.
      The tar file also contains .ssg files which are converted from the .bgl files.
      For further information about introducing scenery, see "6.7 - How do I place objects, like buildings, into FlightGear?" from the FlightGear FAQ
    12. Copy the bitmaps to the top level flight gear directory
      cp *.bmp c:/Program Files/FlightGear/
      
    13. Start up FlightGear as above. You should see the Burning Man scenery.

    Limitations

    Converting Microsoft FlightSimulator BGL files

    8/05, 5/18/05, 5/20/04, 12/28/04
    1. Install Cygwin from http://www.cygwin.com. Basically, you need a full install, or at least g++, gcc OpenGL, automake, fltk, jpeg, libjpeg62, libjpeg6b, libpng, python,
    2. Install plib as per below

      8/05, 5/20/05 - I'm using plib-1.8.4

      5/20/04 - I'm using plib-1.8.3

    3. Place the following files in plib-xxx/src/ssg ssgLoadBGL.cxx ssgLoadBGL.h
    4. Edit plib-1.8.4/src/ssg/Makefile and add ssgLoadBGL.cxx.
      I searched for ssgLoadBMP and added ssgLoadBGL.cxx
    5. Edit plib-1.8.4/src/ssg/ssg.cxx, search for ssgAddModelFormat and add
       ssgAddModelFormat ( ".bgl", ssgLoadBGL , NULL ) ;
      
    6. Edit plib-1.8.4/src/ssg/ssg.h, search for ssgLoadDOF and add
      ssgEntity *ssgLoadBGL  ( const char *fname, const ssgLoaderOptions *options = NULL ) ;
      
    7. Edit plib-1.8.4/src/ssg/ssgLoadBMP.cxx and look for
       /* read and flip image */
        {
          int row_size = w * (bpp / 8) ;
          for ( int y = h-1 ; y >= 0 ; y-- )
          {
            GLubyte *row_ptr = &data [ y * row_size ] ;
            if ( fread ( row_ptr, 1, row_size, curr_image_fd ) != (unsigned)row_size )
            {
              ulSetError ( UL_WARNING, "Premature EOF in '%s'", curr_image_fname ) ;
              return false ;
            }
          }
        }
      
      Change the for loop:
          // for ( int y = h-1 ; y >= 0 ; y-- )
          // Don't FLIP
          for ( int y = 0 ; y < h-1 ; y++ )
          {
      
      You'll need this to avoid having the bitmaps be inverted
      This is a bug in plib-1.8.4, see http://sourceforge.net/tracker/index.php?func=detail&aid=1275291&group_id=382&atid=100382
    8. Remake plib:
      cd plib-1.8.4; ./configure; make; make install
      
    You can either use 3dconvert to convert bgl files, or use ppe. 3dconvert is a simple non-graphical binary that reads in a bgl file and writes an ssg file. ppe is a graphical program that tends to crash that reads in a bgl file, displays it and writes an ssg file.

    Use 3dconvert to convert bgl files

    FlightGear-0.9.8/utils/Modeller/3dconvert.cxx is a simple C++ file that produces a non-graphical filter that take two command line arguments: the input file and the output file.

    See below for details.

    Using ppe to convert bgl files

    1. See the instructions below
      Once ppe is built, to rebuild, do
      cd ppe/src
      rm ppe.exe
      make
      cp ppe.exe c:/cygwin/usr/local/bin/ppe.exe
      
    2. Run ppe.exe on your .bgl file:
      /usr/local/bin/ppe foo.bgl
      
      Note: ppe under Cygwin tends to hang in a tight loop, consuming 100% of the CPU if it gets a window expose event. The workaround is to work only in the ppe window after it comes up.
      To look around, use: View -> Camera -> Rotate h,p
      To move around, use: View -> Camera -> Translate x,y
      If you get the camera in a good location, save the camera with View -> Save Camera. Then, when you restart you can use View -> Load Camera to load the camera position.
      For even faster startup, use the macro facility to save a macro file that loads the camera and then restart with the macro on the command line:
      1. File -> Start Macro Recording
      2. View -> Load Camera Position
      3. Browse to the .cam file and load it
      4. File -> Stop Macro Recording
      5. Save the file as a .py file, for example camera.py
      6. Quit ppe
      7. When you restart, include the camera.py file:
          ppe foo.bgl camera.py
          

      Useful resources:

    3. SCASM: Scenery Assembler for Microsoft Flight Simulator http://www.scasm.de/doc/index.htm
    4. SCDIS: Scenery Decompiler http://freesc.sourceforge.net/scdis.html
    5. Hmm, looks like ssgLoadMDL might have what we need? http://cvs.sourceforge.net/viewcvs.py/plib/plib/src/ssg/ssgLoadMDL.cxx says:

      Revision 1.49 - (download), view (text) (markup) (annotate) - [select for diffs]
      Mon Dec 8 08:22:12 2003 UTC (5 months, 1 week ago) by wolfram_kuss
      Changes since 1.48: +370 -184 lines
      Diff to previous 1.48

      Implemented the most important commands for CFS2 and FS2k2 files (includign "functionality").
      Split off some functions for better readability

    Platform neutral scenery

  • plib can write .atg files (ASCII TerraGear).
  • FlightGear sources includes utils/Modeller/3dconvert.cxx which creates utils/Modeller/threedconvert.exe which can be used to convert files without starting up ppe.

    Edit utils/Modeller/3dconvert.cxx and comment out the simgear/compiler.h include and the SG_GLUT_H include and add GL/glut.h

    //#include <simgear/compiler.h>
    
    #include <iostream>
    
    //#include SG_GLUT_H
    #include <GL/glut.h>
    
    Compile with
     g++ 3dconvert.cxx -o threedconverter.exe -lplibssg -lplibsg -lplibul -lglut32 -lglu32 -lopengl32 -luser32 -lgdi32 -lwinmm
    ~/src/fg/FlightGear-0.9.8/utils/modeller/threedconvert.exe brc1.ssg brc1.atg
    
  • ATG uses rgb images files, which is a SGI format
  • Cygwin includes Imagemagick, which has a convert utility. To run it, use
    convert lamp.bmp sgi:lamp.rgb
    
  • Now the problem is that the lamp posts are not transparent.
    convert lamp.bmp -transparent "#000000" sgi:lamp.rgb
    
  • However, this results in really large files that take a long time to load.
  • Perhaps we should use the btg format, see SimGear-0.3.5/simgear/io/sg_binobj.hxx
  • Checking out plib from cvs
    cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/plib login
    cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/plib co plib/examples
    
  • Sometimes images flash white instead of being nicely textured.

    The workaround under 0.9.6 is to turn off specular reflection. View -> Rendering Options -> Unselect Specular Reflection

    The fix is to modify ssgLoadBGL.cxx so it properly sets the specular material.

  • Images are upside down.
    For example, the lamps are upside down and the sign for the 2004handofgod is upside down. These images are bmp files. The files display properly when viewed with a MS photo manager.

    If I edit 2004handofgod.bgl and change MAGASHEAR.BMP to MAGASHEAR.RGB and then convert the file using

    bmptoppm magashear.bmp | pnmtosgi > magashear.rgb
    
    then ppe displays the new 2004handofgod-new.bgl file with the image in the proper orientation.

    The code in the plib sslLoadBMP.cxx that reads the bmp file is:

     /* read and flip image */
      {
        int row_size = w * (bpp / 8) ;
        for ( int y = h-1 ; y >= 0 ; y-- )
        {
          GLubyte *row_ptr = &data [ y * row_size ] ;
          if ( fread ( row_ptr, 1, row_size, curr_image_fd ) != (unsigned)row_size )
          {
            ulSetError ( UL_WARNING, "Premature EOF in '%s'", curr_image_fname ) ;
            return false ;
          }
        }
      }
    
    If I change the for loop:
        // for ( int y = h-1 ; y >= 0 ; y-- )
        // Don't FLIP
        for ( int y = 0 ; y < h-1 ; y++ )
        {
    
    then the bitmaps view properly.

    The downside with this is that it requires FlightGear be compiled with a new version of plib.

    One solution would be to flip the images:

    bmptoppm magashear.bmp | pnmflip -tb | ppmtobmp > magashear.bmp
    

    It looks like a plib bug, see http://sourceforge.net/tracker/index.php?func=detail&aid=1275291&group_id=382&atid=100382

  • Plib examples: I installed with:
    aclocal
    automake --add-missing
    autoconf
    ./configure
    make
    
    However, the data files are missing
  • Soft Walls and FlightGear 1/18/03

  • The JBSim Docs are useful:
  • http://jsbsim.sourceforge.net/JSBSimCUJ.PDF JSBSim Overview Technical Note
  • http://jsbsim.sourceforge.net/AutomaticFlightInJSBSim.pdf Automatic Flight in JSBSim (PDF - work in progress) September 16, 2003
  • Looks like /FlightGear-0.9.3/src/FDM/JSBSim/FGPosition.h has methods that set the Latitude and Longitude. Other classes are:
    FGModel (base):
    < FGAtmosphere (atmosphere)
    < FGFCS (flight control system)
    < FGPropulsion (engines, propellers, etc.)
    < FGMassBalance (weight and balance)
    < FGAerodynamics (aerodynamic effects)
    < FGInertial (Coriolis acceleration, etc.)
    < FGGroundReactions (landing gear, contact points)
    < FGAircraft (aircraft model as a whole)
    < FGTranslation (translational motion)
    < FGRotation (rotational motion)
    < FGPosition (integrates velocities to get position)
    < FGAuxiliary (various additional calculations)
    < FGOutput (provides for various output features)
    
  • Atlas

    Atlas (http://atlas.sourceforge.net/) " Atlas aims to produce and display high quality charts of the world for users of FlightGear, an open source flight simulator. This is achieved through two main parts: The map creator (simply called Map) and the Atlas viewer."

    Installing Atlas

  • When compiling png.h was not found, so I installed libpng into Cygwin
  • I also had to add -L /usr/local/lib to Makefile
  • To create maps, I downloaded w120n40 from http://www.flightgear.org/Docs/FAQ.shtml#2.6
  • My maps had materials that were not listed, so I added them: I edited FlightGear/data/AtlasPalette and added
    Colour 22	0.275 0.906 0.275 1.0 
    Colour 23	0.375 0.906 0.275 1.0 
    Colour 24	0.275 0.906 0.175 1.0 
    Colour 25	0.175 0.906 0.175 1.0 
    Colour 26	0.175 0.175 0.875 1.0 
    
    and
    Material ShrubCover		22
    Material DeciduousBroadCover	23
    Material EvergreenBroadCover    24
    Material GrassCover		25
    Material IrrCropPastureCover    25	
    Material IntermittentStream	26
    
  • Then I did
    mkdir c:/cxh/src/FlightGear/data/Atlas
    Map --verbose --lat=40.65167 --lon=-119.35417 --fgroot=c:/cxh/src/FlightGear/
    data --atlas=c:/cxh/src/FlightGear/data/Atlas
    
  • I also built low res versions
    mkdir c:/cxh/src/FlightGear/data/Atlas/lowres
    $ Map --size=64 --verbose --lat=40.65167 --lon=-119.35417 --fgroot=c:/cxh/src/F
    lightGear/data --atlas=c:/cxh/src/FlightGear/data/Atlas/lowres
    
  • Messages about the missing Airport/default file can be ignored. That file was removed from CVS, but Atlas has not been updated.
  • Atlas uses the nmea interface to get data from FlightGear. The nmea interface is what GPS can use to get data.

    Start up Atlas:

    Atlas --lat=40.65167 --lon=-119.35417 --fgroot=c:/cxh/src/FlightGear/data --udp=5500
    
    Start up FlightGear
    fgfs --lat=40.65167 --lon=-119.35417 --fg-root=. --aircraft=ufo --nmea=socket,out,0.5,127.0.0.1,5500,udp
    
    While fgfs is running with --nmea, it produces the following output on stdout
    $GPRMC,164608,A,4017.704,N,11836.347,W,3887.7,-286.4,1901104,0.000,E*4F
    $GPGGA,164608,4017.704,N,11836.347,W,1,,,4101,F,,,,*0D
    $GPRMC,164610,A,4018.619,N,11834.431,W,3887.7,-321.7,1901104,0.000,E*4F
    $GPGGA,164610,4018.619,N,11834.431,W,1,,,10370,F,,,,*33
    
  • FlightGear Cygwin Install 1/17/04

    I updated the instructions on 5/20/04 and 12/28/04
    1. Install Cygwin. Basically, you need a full install, or at least OpenGL, probably automake. Consider fltk, jpeg, libjpeg62, libjpeg6b, libpng, libpng12, libpng12-devel, python,
    2. http://www.flightgear.org/Docs/InstallGuide/getstartch2.html#x6-110002.1 Detailed Cygwin installation instructions
    3. Download the most recent version from ftp://ftp.sunsite.org.uk/sites/ftp.flightgear.org/flightgear-ftp/Source/
      I grabbed FlightGear-0.9.6.tar.gz and did
      cd c:/cxh/src/fg
      cat c:/tmp/downloads/flightgear/flightgear-0.9.6.tar.gz | tar -zxf -
      
    4. docs-mini/README.Cygwin says to follow Linux docs, but that OpenGL is already installed so we can ignore GLUT
    5. Linux docs say we need: http://reality.sgi.com/opengl/glut3/glut3.html
      That link is bad, try http://www.opengl.org/resources/libraries/glut/glut_downloads.html?glut#first_hit I grabbed Glut3.7
      FlightGear article about glut and cygwin has some notes that suggest doing a full install of Cygwin.
    6. (1/17/04) I reran Cygwin set up and installed OpenGL, which installed libglut
      bash-2.05b$ ls c:/cygwin/lib/w32api/libglut*
      c:/cygwin/lib/w32api/libglut.a
      c:/cygwin/lib/w32api/libglut32.a
      
      So, no need to rebuild Glut! (8/05) I had to install opengl-1.1.0-6 because opengl-1.1.0-7 did not have /usr/include/GL/gl.h, which is needed for plib below.
    7. Next the FlightGear Linux docs say Install plib from http://plib.sourceforge.net/index.html
      PLIB is comprised of a number of semi-autonomous libraries that you can pretty much mix and match - using as much or as little PLIB as you need. The components libraries are:
      Obtain Plib
      8/05: Check out using CVS
      cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/plib login
      cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/plib co -P plib
      

      5/05?: Download http://plib.sourceforge.net/dist/plib-1.8.3.tar.gz
      Note that 1.8.4 is out
      1. (I ran configure, but had problems with the compiler. Turns out that updating Cygwin for OpenGL installed a new version of gcc, but g++ was not installed.
      2. If you are building from CVS, make sure that autoconf is installed and then run
        cp c:/cygwin/usr/share/automake-1.9/install-sh .
        cp c:/cygwin/usr/share/automake-1.9/depcomp .
        cp c:/cygwin/usr/share/automake-1.9/config.guess .
        cp c:/cygwin/usr/share/automake-1.9/config.sub .
        cp c:/cygwin/usr/share/automake-1.9/missing
        aclocal
        automake
        autoconf
        
        Note: automake --add-missing might copy the files for us
      3. ./configure
        make >& make.out &
        make install
        
      4. (8/05) CVS build problem:
        In file included from ul.cxx:25:
        ul.h:113: windows.h: No such file or directory
        ul.h:114: mmsystem.h: No such file or directory
        ul.h:115: regstr.h: No such file or directory
        
        I was accidentally compiling with gcc-2.95.3. Instead, I should use gcc-3.4.4.
    8. http://www.simgear.org I chose simgear-0.3.8, which is required by FlightGear 0.9.8
      SimGear is a set of open-source libraries designed to be used as building blocks for quickly assembling 3d simulations, games, and visualization applications.

      SimGear is a relatively new project, and while quite a bit of code has been written in conjunction with the FlightGear project, the final interface and arrangements are still evolving.

      The term "Simulation Kernel" is a bit presumptuous for us at this point, but this is the direction we are heading with SimGear.

    9. SimGear requires OpenAL from http://www.openal.org http://mail.flightgear.org/pipermail/flightgear-devel/2004-September/030776.html says to get ftp://ftp.ihg.uni-duisburg.de/FlightGear/Win32/openal_cyg.tgz
      cat c:/tmp/downloads/flightgear/openal_cyg.tgz | tar -zxvf -
      

      Old instructions:
      http://www.seedwiki.com/wiki/Flight%20Gear/MinGW/cross-compiler%20writeup.htm?wpid=143946 says that OpenAL can't easily be compiled with Cygwin and suggests downloading http://plausible.org/andy/fgfs-mingw-libs.tar.gz (but that is for Mingw?) I downloaded it, untared it and did:

      cd c:/cygwin/usr
      cat /cygdrive/c/tmp/downloads/flightgear/openal.tar | tar -xvf -
      
      Note that for versions of SimGear before SimGear-0.3.8, I used to cd to c:/cygwin/usr/local, but since this machine now has the Cygwin X11 libraries, it seems I need to cd to c:/cygwin/usr/X11R6.

      SimGear-0.3.8: Actually, we need to install in c:/cygwin/usr because we need to configure Simgear without Cygwin X11R6 (see below)

      I also installed the OpenAL Windows Runtime.

    10. Compiling SimGear
      cd ../SimGear-0.3.8
      ./configure
      make >& make.out &
      
    11. Compilation of ephemeris.cxx fails under gcc 3.4.4
      Making all in ephemeris
      make[3]: Entering directory `/cygdrive/c/cxh/src/fg/SimGear-0.3.8/simgear/ephemeris'
      if g++ -DHAVE_CONFIG_H -I. -I. -I../../simgear -I../..  -I/usr/X11R6/include  -g -O2 -D_REENTRANT -MT ephemeris.o -MD -MP -MF ".deps/ephemeris.Tpo" -c -o ephemeris.o ephemeris.cxx; \
      then mv -f ".deps/ephemeris.Tpo" ".deps/ephemeris.Po"; else rm -f ".deps/ephemeris.Tpo"; exit 1; fi
      In file included from /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/vector:72,
                       from ../../simgear/math/sg_types.hxx:40,
                       from ../../simgear/misc/sg_path.hxx:36,
                       from ../../simgear/ephemeris/stardata.hxx:31,
                       from ephemeris.hxx:45,
                       from ephemeris.cxx:28:
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h: In member function `void std::vector<bool, _Alloc>::_M_insert_range(std::_Bit_iterator, _ForwardIterator, _ForwardIterator, std::forward_iterator_tag)':
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h:522: error: expected unqualified-id before '(' token
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h: In member function `void std::vector<bool, _Alloc>::_M_fill_insert(std::_Bit_iterator, size_t, bool)':
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/include/c++/bits/stl_bvector.h:823: error: expected unqualified-id before '(' token
      
      This is probably a min/max definition problem, see http://www.mail-archive.com/gcc-bugs@gcc.gnu.org/msg127560.html

      http://www.mail-archive.com/flightgear-devel@flightgear.org/msg34535.html suggests not compiling with gcc-3.4.4

      The problem is that c:/cygwin/usr/include/w32api/windef.h has:

      #ifndef NOMINMAX
      #ifndef max
      #define max(a,b) ((a)>(b)?(a):(b))
      #endif
      #ifndef min
      #define min(a,b) ((a)<(b)?(a):(b))
      #endif
      #endif
      
      So, the solution is to define NOMINMAX when compiling
    12. While compiling simgear/sound, I got errors about openal, so I edited Makefile and changed
      openal_LIBS =  -lalut -lwinmm -ldsound -ldxguid -lole32
      
      to
      openal_LIBS =  -L/usr/local/lib -lopenal32 -lalut -lwinmm -ldsound -ldxguid -lole32
      
    13. Continuing with compiling SimGear:
      make
      make install
      
    14. Simgear-0.9.8, problem compiling sky/clouds3d/extgl.c:
      make[5]: Entering directory `/cygdrive/c/cxh/src/fg/SimGear-0.3.8/simgear/scene/sky/clouds3d'
      if gcc -DHAVE_CONFIG_H -I. -I. -I../../../../simgear -I../../../..  -I/usr/X11R6/include  -g -O2 -D_REENTRANT -MT extgl.o -MD -MP -MF ".deps/extgl.Tpo" -c -o extgl.o extgl.c; \
      then mv -f ".deps/extgl.Tpo" ".deps/extgl.Po"; else rm -f ".deps/extgl.Tpo"; exit 1; fi
      In file included from extgl.c:85:
      extgl.h:363: error: 'glBlendColor' redeclared as different kind of symbol
      /usr/X11R6/include/GL/gl.h:1652: error: previous declaration of 'glBlendColor' was here
      
      I tried editing simgear/scene/sky/Makefile and comment out
      SUBDIRS=clouds3d
      
      but then compiling FlightGear-0.9.8 later failed.

      http://www.mail-archive.com/flightgear-devel@flightgear.org/msg10002.html suggests uninstalling Cygwin X-windows

      mv c:/cygwin/usr/X11R6 c:/cygwin/usr/X11R6.bak
      ./configure
      

      Simgear configure reported openAL was missing, so I did

      cd c:/cygwin/usr
      cat /cygdrive/c/tmp/downloads/flightgear/openal.tar | tar -xvf -
      

      Continue with

      make clean
      make
      make install
      
    15. Compiling FlightGear:
    16. cd ../FlightGear-0.9.8
      ./configure
      make >& make.out &
      
    17. While compiling Flightgear 0.9.3:
      g++  -g -O2   -o test-up.exe  test-up.o -lsgmath -lsgdebug -lplibsg -lplibul
      /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/../../../../i686-pc-cygwin/bin/ld: cannot
      find -lsgmath
      
      http://www.mail-archive.com/flightgear-users@flightgear.org/msg05226.html suggests that /usr/local/lib/libsgmath.a is not being found. I edited FlightGear-0.9.3/tests/Makefile and added -L/usr/local/lib
      test_up_LDADD = -L/usr/local/lib -lsgmath -lsgdebug -lplibsg -lplibul $(base_LIBS)
      
    18. Re ran make, same problem occurred in src/Airports
    19. Re ran make, same problem occurred in src/FDM/YASim
    20. Re ran make, same problem occurred in src/Navaids
    21. Re ran make, same problem occurred in src/Main
    22. make install
    23. Install the data files in /usr/local/lib
      This is a 75Mb tar file download. If you already have downloaded FlightGear, then the same files might be at c:/Program Files/FlightGear/
      cd /usr/local/lib
      ln -s c:/Program*/FlightGear FlightGear
      
    24. To start up
      cd ~/src/fg/FlightGear-0.9.6/src/Main
      ./runfgfs
      
      
      or
      /usr/local/bin/fgfs --fg-root=/usr/local/lib/FlightGear --enable-auto-coordination
      
      Or
       fgfs --fg-root=/cygdrive/c/cxh/src/FlightGear
      
      or
      fgfs --fg-root="/usr/local/lib/FlightGear" --aircraft=ufo --timeofday=noon --log-level=info --lat=40.75 --lon=-119.23 --disable-clouds --disable-clouds3d --fog-disable
      
    25. Got
      Fatal error: Failed to buffer data.
       (received from )
      
      The problem was OpenAL, I installed openal_cyg.tgz above, reconfigure SimGear, cleaned, rebuilt and installed SimGear, reconfigured, cleaned, rebuilt and installed FlightGear.

    FlightGear and Soft Walls

  • Hacking has several good answers
  • How do I design a flight dynamics model for a new aircraft?
  • http://baron.flightgear.org/pipermail/flightgear-flightmodel/2004-January/002646.html:
    > Hello. I've just recently found out about FlightGear. I'm interested in
    > adding a new flight model to it. My bachelor's thesis was the flight
    > equations for a general aviation light aircraft flight simulator. I
    > would like to try to implement them into FlightGear. I've started
    > sifting through the source code, but if someone could give me some
    > pointers in the right direction it would be very helpful. In particular,
    > any help in identifying what the interface is between the flight model
    > and the rest of the FlightGear simulator would be very much appreciated.
    
     

    Alex:

    Look at one of the FGInterface derivative classes, either FGJSBSim, or FGYasim for starters.

    Is your thesis online anywhere?

    You could also peruse the www.JSBSim.org site - we've got lots of FDM related material there.

  • http://www.jsbsim.org/
    JSBSim is an open source flight dynamics model (FDM) that compiles and runs under many operating systems, including Microsoft Windows, Apple Macintosh, Linux, IRIX, Cygwin (Unix on Windows), etc. The FDM is essentially the physics/math model that defines the movement of an aircraft under the forces and moments applied to it using the various control mechanisms and from the forces of nature. JSBSim has no native graphics. It can be run by itself as a standalone program, taking input from a script file and various aircraft configuration files; or, it can be run as an integrated part of a larger flight simulator implementation that includes a visual system. The most notable example of the use of JSBSim is currently seen in the open source FlightGear simulator. JSBSim models the aerodynamic forces and moments by the classic coefficient buildup method.
  • src/FDM/JSBSim looks interesting
  • src/FDM/ExternalPipe/ExternalPipe.cxx is a pipe interface to an external flight dynamics model Section 1.4 below says
    It is even possible to drive Flight Gear's scene display using an external FDM running on a different computer - although this might not be a setup recommended to people just getting in touch with FlightGear.
  • Go to google and search site:baron.flightgear.org External FDM
  • --fdm=abcd Select the core flight model. Options are jsb, larcsim, yasim, magic, balloon, external, ada, null. Default value is jsb (JSBSim). larcsim is the flight model which FlightGear inherited from the LaRCSim simulator. yasim is Any Ross Yet Another Flight Dynamics Simulator. Magic is a slew mode (which drives the UFO aircraft). Balloon is a hot air balloon. External refers to remote control of the simulator. Null selects no flight dynamics model at all. The UIUC flight model is not chosen this way but via the next option! For further information on flight models cf. Section ;1.4 and below.
  • Section 1.4 Flight Dynamic Models describes the models
  • http://baron.flightgear.org/pipermail/flightgear-users/2002-August/001502.html says
    The file 'src/Network/net_fdm.hxx' defines the data structure you will > have to send.
  • http://baron.flightgear.org/pipermail/flightgear-devel/2002-September/011846.html
    Some of the benefits of running the FDM portion as a standalone app separate from flight gear are:
    - you can kill and restart the fdm portion without restarting FG.
    - you can change/recompile/rerun the fdm portion without restarting FG.
    - when developing the fdm portion, you don't need to spend the overhead of compiling/linking with FG and starting FG from scratch.
    - you can interface non-GPL'd flight dynamics code via this mechanism.
    - you can run the FDM on a separate machine/OS, separate CPU, you could even develop it in a different computer language.
  • http://www.u-dynamics.com/aerosim/default.htm Commercial Matlab/Simulink block libraries for UAVs - freely available to non-commercial users
  • Hmm, looks like ssgLoadMDL might have what we need? http://cvs.sourceforge.net/viewcvs.py/plib/plib/src/ssg/ssgLoadMDL.cxx says:

    Revision 1.49 - (download), view (text) (markup) (annotate) - [select for diffs]
    Mon Dec 8 08:22:12 2003 UTC (5 months, 1 week ago) by wolfram_kuss
    Changes since 1.48: +370 -184 lines
    Diff to previous 1.48

    Implemented the most important commands for CFS2 and FS2k2 files (includign "functionality").
    Split off some functions for better readability

    Rebuilding ppe with plib-1.8.4 under Cygwin

    1. Download PPE via cvs

      As of 5/20/04, it seemed like the cvs site was down?

      The commands to obtain:

      cvs -d:pserver:anonymous@cvs.prettypoly.sourceforge.net:/cvsroot/prettypoly login
      cvs -d:pserver:anonymous@cvs.prettypoly.sourceforge.net:/cvsroot/prettypoly co ppe
      
      Try http://prettypoly.sourceforge.net/download/current.tgz
    2. Note that I had fltk1.2 installed already.
      However, while linking ppe, I was getting errors, so I reconfigure fltk-1.2.x with
      autoconf
      ./configure --enable-cygwin --enable-win9x
      make
      make install
      
      The --enable-win9x configure option is necessary to fix this problem:
      Compiling Fl_Image.cxx...
      In file included from Fl_Image.cxx:357:
      win/Image.cxx: In member function `virtual void 
         Fl_Win_Display::draw(Fl_RGB_Image*, int, int, int, int, int, int)':
      win/Image.cxx:103: error: `AlphaBlend' undeclared (first use this function)
      win/Image.cxx:103: error: (Each undeclared identifier is reported only once for 
         each function it appears in.)
      make[1]: *** [Fl_Image.o] Error 1
      
    3. Configure ppe
      aclocal
      autoconf
      automake --add-missing
       ./configure --with-python-inc=/usr/include/python2.4
      
      I had to edit configure.in and remove examples/Makefile and then rerun the above to create Makefile.in

      I had to copy the fltk libraries to /usr/lib:

      cp /usr/local/lib/libfl* /usr/lib
      
    4. Also, make sure that fluid is in your path.
      Either add /usr/local/bin to your path or cp /usr/local/bin /usr/bin
    5. I ran in to problems with stl_bvector.h. See above for the solution.
    6. if g++ -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"ppe\" -DVERSION=\"0.0.1\" -DHAVE_BOOL=1 -DX_DISPLAY_MISSING=1 -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DWIN32=1 -DSTDC_HEADERS=1 -DHAVE_GL_GL_H=1 -DHAVE_GL_GLUT_H=1 -DHAVE_PNG_H=1 -DHAVE_JPEGLIB_H=1  -I. -I. -I../../src -I/usr/X11/include    -g -O2 -MT image.o -MD -MP -MF ".deps/image.Tpo" -c -o image.o image.cxx; \
      then mv -f ".deps/image.Tpo" ".deps/image.Po"; else rm -f ".deps/image.Tpo"; exit 1; fi
      In file included from /usr/include/jpeglib.h:30,
                       from jpegimg.h:58,
                       from image.cxx:57:
      /usr/include/jmorecfg.h:250: error: conflicting declaration 'typedef long int INT32'
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/basetsd.h:52: error: 'INT32' has a previous declaration as `typedef int INT32'
      /usr/include/jmorecfg.h:250: error: declaration of `typedef long int INT32'
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/basetsd.h:52: error: conflicts with previous declaration `typedef int INT32'
      /usr/include/jmorecfg.h:250: error: declaration of `typedef long int INT32'
      /usr/lib/gcc/i686-pc-cygwin/3.4.4/../../../../include/w32api/basetsd.h:52: error: conflicts with previous declaration `typedef int INT32'
      
      Edit /usr/include/jmorecfg.h and #define XMD_H or comment that code out.
    7. Problems linking. Solution: edit ppe/src/Makefile and add the following libs
      LIBS = -L/lib/python2.4/config -L/usr/local/lib/python2.4/config -lpython2.4 -L/usr/local/lib -lfltk_gl -lfltk -lwsock32 -lplibfnt -lplibssgaux -lplibssg -lplibsg -lplibul  -lpng -ljpeg -lm -lwinmm -lglu32 -lopengl32 -luser32 -lgdi32
      
    8. When starting up ppe, I get a message about default_bindings missing. I obtained this file from the Windows installation of ppe and did:
      mkdir -p /usr/share/ppe/scripts
      cp ../old/ppewin/default_bindings.py !$
      

    Rebuilding ppe with plib-1.8.3 under MSVC

    5/23/04 - ppe under cygwin was crashing when I tried using the material editor. So, I decided to rebuild ppe under MSVC

    Build fltk-1.2.x

    1. Download fltk-1.2
      It seems like fltk-1.2 is not available as a separate download? I had to use CVS. Cygwin include fltk as well
      export CVSROOT=:pserver:anonymous@cvs.sourceforge.net:/cvsroot/fltk
      cvs login
      cvs -z9 get -d fltk-1.2.x -r v1_2 fltk
      
    2. Open fltk-1.2.x\visualc
    3. Build
    4. strcasecmp errors
      :\cxh\src\fltk-1.2.x\src\filename_list.cxx(46) : error C2065: 'strcasecmp' : undeclared identifier
      
      Solution: edit flstring.g and define strcasecmp under Windows
      #  if defined(__APPLE__) && defined(__MWERKS__) && defined(_MSL_USING_MW_C_HEADERS)
      int strcasecmp(const char*,const char*);
      int strncasecmp(const char*,const char*,int);
      char *strdup(const char*);
      #  else defined(WIN32) && ! defined (CYGWIN)
      #define strcasecmp(s1,s2) stricmp(s1,s2)
      #  endif
      

    Build ppe

    1. Set up the plib include directory. There is a script
      mkdir c:/Program\ Files/Microsoft\ Visual\ Studio/VC98/Include/ppe
      
    2. Edit ppe/msvc/copy_plib_headers.bat and change the location of plib/ to plib-1.8.3/
    3. Start -> Run -> cmd, then invoke ppe\msvc\copy_plib_headers.bat
    4. Problem: ssgconf.h is missing Solution: copy files:
      cp c:/cxh/src/plib-1.8.3/src/ssg/ssgconf.h c:/Program\ Files/Microsoft\ Visual\ Studio/VC98/Include/plib/
      
      Also missing:
      cp c:/cxh/src/plib-1.8.3/src/ssgAux/ssgaParticleSystem.h !$
      cp c:/cxh/src/plib-1.8.3/src/ssgAux/ssgaFire.h !$
      cp c:/cxh/src/plib-1.8.3/src/ssgAux/ssgaWaveSystem.h !$
      cp c:/cxh/src/plib-1.8.3/src/ssgAux/ssgaLensFlare.h .
      cp c:/cxh/src/plib-1.8.3/src/ssgAux/ssgaScreenDump.h .
      
    5. Set the include path to include fltk-1.2.x and python: Project -> Settings -> C/C++ -> Preprocessor
      c:\cxh\src\ppe,c:\cxh\src\ppe\src,C:\cygwin\usr\include\Python2.3,c:\Program Files\microsoft visual studio\vc98\include\ppe,C:\cxh\src\fltk-1.2.x,C:\cxh\src\plib-1.8.0
      
    6. Problems including python.h from Cygwin, which includes unistd.h
      Solution: Install Python as a native Windows app
    7. During link of ppe: missing symbols:
      ppeEventHandler.obj : error LNK2001: unresolved external symbol "public: void __thiscall Fl_Gl_Window::make_current(void)" (?make_current@Fl_Gl_Window@@QAEXXZ)
      
      Solution: build fltkgld.lib by opening fltk-1.2.x/visualc/fltkgl.dsw and build it, then add fltk-1.2.x/lib/fltkgld.lib to ppe libs
  • More linking problems while creating ppe:
    --------------------Configuration: ppe - Win32 Debug--------------------
    Linking...
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _toupper already defined in LIBCD.lib(toupper.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _tolower already defined in LIBCD.lib(tolower.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isupper already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isalpha already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _realloc already defined in LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _free already defined in LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _malloc already defined in LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isspace already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strchr already defined in LIBCD.lib(strchr.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isalnum already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _memmove already defined in LIBCD.lib(memmove.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isdigit already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isxdigit already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strncmp already defined in LIBCD.lib(strncmp.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strrchr already defined in LIBCD.lib(strrchr.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sprintf already defined in LIBCD.lib(sprintf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _floor already defined in LIBCD.lib(floor.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtol already defined in LIBCD.lib(strtol.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strtod already defined in LIBCD.lib(strtod.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _sscanf already defined in LIBCD.lib(sscanf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _getenv already defined in LIBCD.lib(getenv.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strstr already defined in LIBCD.lib(strstr.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _isprint already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fread already defined in LIBCD.lib(fread.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fopen already defined in LIBCD.lib(fopen.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _qsort already defined in LIBCD.lib(qsort.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _calloc already defined in LIBCD.lib(dbgheap.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _atoi already defined in LIBCD.lib(atox.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _atof already defined in LIBCD.lib(atof.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _strcspn already defined in LIBCD.lib(strcspn.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fgets already defined in LIBCD.lib(fgets.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fprintf already defined in LIBCD.lib(fprintf.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fputc already defined in LIBCD.lib(fputc.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _fwrite already defined in LIBCD.lib(fwrite.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _bsearch already defined in LIBCD.lib(bsearch.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: _islower already defined in LIBCD.lib(_ctype.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __stricmp already defined in LIBCD.lib(stricmp.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __getcwd already defined in LIBCD.lib(getcwd.obj)
    MSVCRTD.lib(MSVCRTD.dll) : error LNK2005: __stat already defined in LIBCD.lib(stat.obj)
    LINK : warning LNK4098: defaultlib "MSVCRTD" conflicts with use of other libs; use /NODEFAULTLIB:library
    ppeCoreFuncs.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
    ppeViewFuncs.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
    pythonInterface.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs
    fltkd.lib(Fl_x.obj) : error LNK2001: unresolved external symbol __imp___TrackMouseEvent@4
    Debug/ppe.exe : fatal error LNK1120: 3 unresolved externals
    Error executing link.exe.
    
    ppe.exe - 47 error(s), 1 warning(s)
    
    
    http://curl.haxx.se/mail/lib-2002-09/0125.html suggests recompiling using /MD

    Get rid of trackmouse warning by editing fltk-1.2.x/src/Fl_win32.cxx and commenting out the define:

    //
    // USE_TRACK_MOUSE - define it if you have TrackMouseEvent()...
    //
    // Apparently, at least some versions of Cygwin/MingW don't provide
    // the TrackMouseEvent() function.  You can define this by hand
    // if you have it - this is only needed to support subwindow
    // enter/leave notification under Windows.
    //
    
    //#define USE_TRACK_MOUSE
    
    #if !defined(__GNUC__)
    //#  define USE_TRACK_MOUSE
    #endif // !__GNUC__
    
    

    Missing python symbols

    ppeCoreFuncs.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
    ppeViewFuncs.obj : error LNK2001: unresolved external symbol __imp___Py_RefTotal
    pythonInterface.obj : error LNK2001: unresolved external symbol __imp__Py_InitModule4TraceRefs
    
    Solution: Download Python sources and recompile
    Older confusing details below here
    http://www.flightgear.org/Docs/FAQ.shtml#6.5
    6.5 - How do I import BGL scenery from Microsoft Flight Simulator?

    See http://chiangt.virtualave.net/BGL/bgl_index.html.

    However, that site is missing.

    http://web.archive.org/web/20021208104536/chiangt.virtualave.net/BGL/bgl_index.html - The archive.org listing from 12/08/2002 looks much like what is below.

    http://matrixsoft.50megs.com/BGL/ eventually gets redirected to:

    http://www.geocities.com/tengchiangtsao/ is reproduced below.

    I've indented the original text and added my comments.


    Adding www.flightsim.com's Scenery to FlightGear flight simulator

    Hi folks,

    For developers, please come here.


    The developer docs can be found below.

    Otherwise, follow the following steps. This version of ppe can convert .bgl models to generic .ssg models. It already statically linked my modified verion of plib. 1. Download ppe

  • .tar.gz and do
        tar -xzf ppe.tar.gz
    

    ppe is the PrettyPoly Editor. The tar file above includes ppe/src/ppe, which is a linux binary.

    To install ppe it, you will need OpenGL, Python, FLTK and Plib See the plib notes above.

    To install Python, get it from Cygwin setup.

    ./configure
    

    2. Download textures.zip and extract to /usr/local/lib/FlightGear/Textures or wherever we like.

    3. Do this before running ppe only if you use PATH or full path name to run ppe instead of running PPE from it's install directory.

       export PPE_ROOT=/where/we/put/my-version/of/ppe
    
    Otherwise python will complain default_bindings problems.

    4. Rename the *.bgl file that we want to convert to *.mdl


    I used this:
    files=*.bgl
    for file in $files
    do 
    	mv $file `basename $file .bgl `.mdl
    done
    

    5. Goto /where/we/put/my-version/of/ppe . Modify the first line of ppe to correctly point to shell interperter. Then, do

       ./ppe
    

    6. Now, when we open the .bgl model (actually renamed to *.mdl already) in PPE we may not be able to see the texture because I hard coded the input texture's directory to /usr/local/lib/FlightGear/Textures (we may make a symbolic link to see the textures, any ways). I will improve this later.

    7. But the most important thing is to setup the *.ssg model's output texture directory correctly. If we didn't do the previous step right but set up this thing correctly, the final product is still good.
    Goto the small model editor window of PPE, select "Edit"->"Preference" and enter the texture path (see step 2).

    8. Now look at the big window of PPE (where our model is rendered), if we are happy with the scene, we are ready to output the *.ssg file. Otherwise, manually edit the scene (I don't know how to do this though).

    9. Goto the "File"->"Save As" menu, and enter the file name with a ".ssg" extension. PPE will convert the file to ssg format. I found SSG format is the best for FlightGear.

    10. Here comes the hard part. We need to feagure out where the scene is located. For example, Boston is located in w072n42 (/usr/local/lib/FlightGear/Scenery/w080n40/w072n42). Some tourist maps from "Barn's And Novel" or CVS drug store may help. : )

    11. Not done yet. Make a *.stg file that has a line like the following: OBJECT_STATIC boston.ssg -71.08 42.30 0 0 If the file already exists, append this line to the end.

    12. To learn how to calculate the * magic number, please visit Cameron Moore's FG FAQ[6.5]. The FAQ is shipped with FlightGear base package. (FlightGear/Docs/FlightGear-FAQ.html)

    For me, i used to fly to where i want to put the city and write down the (lon,lat), for example, Boston is (-71.08, 42.30) and then start Fgfs again with the (lon,lat) as command line option like this: fgfs --lat=42.30 --lon=-71.08 2>&1 | tee fgfs.log

    I ran scdis on brc.bgl, which reported:
    ;max north:	N40:45:38.97
    ;min north:	N40:44:41.43
    ;max east:	W119:14:6.60
    ;min east:	W119:14:6.60
    
    So, I would run
     fgfs --lat=40.75 --lon=-119.23 --log-level=info
    
    1. West Longituded is negative (-119.23)
    2. --log-level=info is necessary to get the tile info
  • I downloaded w120n40 from http://www.flightgear.org/Docs/FAQ.shtml#2.6 And then used the FlightGear Scenery Installer (Start -> All Programs -> FlightGear v 0.9.6 -> Install & Uninstall Scenery) to install the scenery
    c:/Program\ Files/FlightGear/data/Scenery/Objects
    cat c:/tmp/downloads/flightgear/w120n40.tar.gz | tar -zxf -
    
    I appended
    OBJECT_STATIC 2002faces.ssg -119.23 40.75 1189 0
    OBJECT_STATIC 2003gravity.ssg -119.23 40.75 1189 0
    OBJECT_STATIC 2004handofgod.ssg -119.23 40.75 1189 0
    OBJECT_STATIC brc1.ssg -119.23 40.75 1189 0
    OBJECT_STATIC brc2.ssg -119.23 40.75 1189 0
    OBJECT_STATIC brcplan.ssg -119.23 40.75 1190 0
    OBJECT_STATIC contessa.ssg -119.23 40.75 1189 0
    OBJECT_STATIC duckybar.ssg -119.23 40.75 1189 0
    OBJECT_STATIC plastic_chapel.ssg -119.23 40.75 1189 0
    OBJECT_STATIC testwow.ssg -119.23 40.75 1189 0
    
    These have problems
    OBJECT_STATIC 2003honor.ssg -119.23 40.75 1189 0
    OBJECT_STATIC centercamp1.ssg -119.23 40.75 1189 0
    OBJECT_STATIC centercamp2.ssg -119.23 40.75 1189 0
    OBJECT_STATIC 2003man.ssg -119.23 40.75 1189 0
    
    to : c:/Program Files/FlightGear/data/Scenery/w120n40/w120n40/991419.stg (The 1189 is the height in meters)

    Then, open fgfs.log with a text editor and find the keyword "Loading tile" At the end of the line of the first "Loading title" is the magic number. For Boston, it is about 1777947. Note: the FAQ says *.ind, but we use *.stg in FlightGear 0.7.9

    13. Finally, put the *.stg file and *.ssg file in the scenery location directory. For Boston, I put 1777947.stg and boston.ssg in /usr/local/lib/FlightGear/Scenery/w080n40/w072n42


    Notes for developers who want to compile ppe

    These notes are from http://www.geocities.com/tengchiangtsao/developers.html
    The original text is indented, my comments are not.

    Hi developers,

    ssgLoadBGL.cxx is being developed. It is based on ssgLoadMDL.cxx. An newest alpha version of it . Demo scenery in this page are Stuttgart and Boston.

    Procedure :

    1.Make sure we have the newest PPE from cvs and the PPE works fine for normal .mdl models . *


    cvs -d:pserver:anonymous@cvs.prettypoly.sourceforge.net:/cvsroot/prettypoly login cvs -d:pserver:anonymous@cvs.prettypoly.sourceforge.net:/cvsroot/prettypoly co ppe

    As of 5/20/04, it seemed like the cvs site was down?

    As of 2/04, the cvs version of ppe uses fltk-1.2.x, not fltk-2.0. If you try to compile with fltk-2.0, you will get:

    thumbnail.h:55:25: FL/Fl_Image.H: No such file or directory
    
    ppe requires automake, so we install it using Cygwin setup
    rm -f config.*
    aclocal
    automake -a
    autoconf
    ./fluidizer.py
    ./configure
    
    Configure could not find python, I did:
     ./configure --with-python-inc=/usr/include/python
    
    Configure barfed with
    configure: error: conditional "ENABLE_XMESA_FX" was never defined.
    Usually this means the macro was only invoked conditionally.
    
    http://baron.flightgear.org/pipermail/flightgear-users/2002-October/002285.html said:
        < dnl    AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
        ---
        >     AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
    
    I ended up with:
      if test "x$ac_cv_lib_MesaGL_glNewList" = "xyes" ; then
        AC_CHECK_HEADER(GL/xmesa.h)
        dnl AM_CONDITIONAL(ENABLE_XMESA_FX, 
        dnl            test "x$ac_cv_header_GL_xmesa_h" = "xyes")
      else
        dnl force a failed check
        dnl AM_CONDITIONAL(ENABLE_XMESA_FX, test "no" = "yes")
        echo "force a failed check for XMESA?"
      fi
    
    make 
    
    Failed with:
    In file included from madGUI.h:5,
                     from madGUI.cxx:3:
    thumbnail.h:55:25: FL/Fl_Image.H: No such file or directory
    
    FL/Fl_Image.H is from Fltk-1.2. So, in 2/04, the cvs version of ppe requires Fltk-1.2, not Fltk-2.0.

    For instructions on downloading Fltk-1.2, see http://www.fltk.org/software.php?SOFTWARE=v1_2

    export CVSROOT=:pserver:anonymous@cvs.fltk.sourceforge.net:/cvsroot/fltk
    cvs login (press ENTER when asked for a password)
    cvs -z3 get -rv1_2 -d fltk-1.2.x fltk
    cd fltk-1.2.x
    autoconf
    ./configure
    make >& make.out &
    make install
    
    Back to making ppe:
    In file included from madGUI.h:19,
                     from madGUI.cxx:3:
    colorbutton.h: In member function `virtual void ColorButton::draw()':
    colorbutton.h:86: error: `down' undeclared (first use this function)
    colorbutton.h:86: error: (Each undeclared identifier is reported only once for 
       each function it appears in.)
    make[3]: *** [madGUI.o] Error 1
    
    Looks like ppe is dated from January, 2001, so I tried fltk-1.0.11, which is from
    cd fltk-1.0.11
    autoconf
    
    configure failed, so I did
    configure --without-x
    
    which also did not work, so I tried fltk-1.1.4
    cd fltk-1.1.4
    ./configure
    make
    
    Aww, to heck with it. fltk-1.1.4/CHANGES says
    - Renamed down() and frame() to fl_down() and fl_frame(), filename_xyz() to fl_filename_xyz(), and all of the define_FL_FOO() functions for the custom boxtypes to fl_define_FL_FOO() to avoid namespace clashes.
    So, I changed ppe/src/material/colorbutton.h from down( to fl_down(

    madscantree.cxx: In member function `void Mad::scanLibrary()':
    madscantree.cxx:172: error: `filename_list' undeclared (first use this
       function)
    madscantree.cxx:172: error: (Each undeclared identifier is reported only once
       for each function it appears in.)
    madscantree.cxx:176: error: `filename_match' undeclared (first use this
    
    filename_list -> fl_filename_list
    filename_match -> fl_filename_match

    Ditto with madfile.cxx and mad.cxx

    While compiling in ppe/src/gui

    ppeGUIFuncs.cxx:53:20: Python.h: No such file or directory
    In file included from ppeGUIFuncs.cxx:54:
    ../../src/ppeFuncs.h:52: error: type specifier omitted for parameter `PyObject'
    ../../src/ppeFuncs.h:52: error: syntax error before `*' token
    ppeGUIFuncs.cxx:74: error: syntax error before `*' token
    ppeGUIFuncs.cxx:75: error: syntax error before `*' token
    ppeGUIFuncs.cxx:76: error: syntax error before `*' token
    
    ppe/src/gui/Makefile
    INCLUDES = -I$(top_srcdir)/src -I.. -I/usr/include/python -I/usr/X11/include
    
    INCLUDES = -I$(top_srcdir)/src -I.. -I/usr/include/python2.3 -I/usr/X11/include
    
    It happened again in src/core, so I did
    cd /usr/include
    ln -s python2.3 python
    

    In ppe/src/core:

    ppeCoreFuncs.cxx: In function `PyObject* ppePyHookMergeHNodes(PyObject*,
       PyObject*)':
    ppeCoreFuncs.cxx:1724: error: `mergeHNodes' undeclared (first use this
       function)
    ppeCoreFuncs.cxx:1724: error: (Each undeclared identifier is reported only once
    
    
    mergeHNodes probably comes from plib/ssg.h

    Solution: comment it out:

    PYTHONFUNC(ppePyHookMergeHNodes)
    
            printf("ppePyHookMergeHNodes: no mergeHNodes");
            //  PYTHON_FUNC_START_NO_ARG
            //curr_viewer->getSceneRoot()->mergeHNodes();
    
      
    	curr_viewer -> changed () ; RETURN_NOTHING ;
    }
    
    Problem:
    ppeWalkScene.cxx: In function `void removeDuplicateNodes()':
    ppeWalkScene.cxx:541: error: `compare' undeclared (first use this function)
    ppeWalkScene.cxx:541: error: (Each undeclared identifier is reported only once 
       for each function it appears in.)
    
    Solution: that method is unused, comment the body out. Problems with misc/image.cxx
    In file included from /usr/include/c++/3.3.1/bits/locale_facets.tcc:43,
                     from /usr/include/c++/3.3.1/locale:47,
                     from /usr/include/c++/3.3.1/bits/ostream.tcc:37,
                     from /usr/include/c++/3.3.1/ostream:535,
                     from /usr/include/c++/3.3.1/iostream:45,
                     from image.cxx:54:
    /usr/include/c++/3.3.1/limits:205:22: macro "min" requires 2 arguments, but only 1 given
    
    Solution: Move the iostream.h include to before the image.h include

    edit jmorecfg.h and comment out

    #ifndef XMD_H			/* X11/xmd.h correctly defines INT32 */
    //typedef long INT32;
    #endif
    

    Problems finding python2.4

    cannot find -lpython2.4
    
    Edit src/Makefile and change
     -L/usr/lib/python2.1/config
    
    to
     -L/lib/python2.4/config
    

    Problems linking:

    ppe.o(.text+0xd4e): In function `main':
    /cygdrive/c/cxh/src/ppenew/ppe/src/ppe.cxx:445: undefined reference to `Fl::gl_visual(int, int*)'
    ../src/gui/libppegui.a(ppeEventHandler.o)(.text+0x926): In function `_ZN15ppeEventHandler6handleEiP9ppeViewer':
    
    Solution: added -lfltk_gl, -lpng, -ljpeg
    LIBS = -L/lib/python2.3/config -L/usr/local/lib/python2.1/config -lpython2.3 -L/usr/local/lib -lfltk_gl -lfltk -lwsock32 -lplibfnt -lplibssgaux -lplibssg -lplibsg -lplibul  -lpng -ljpeg -lm -lwinmm -lglu32 -lopengl32 -luser32 -lgdi32
    LTLIBOBJS = 
    

    Problems with _ctype in fltk, edited fltk-1.1.4/src/makeinclude and removed -mno-cywin, recompiled fltk

    Problem with filename_list.cxx:

    filename_list.cxx: In function `int fl_filename_list(const char*, dirent***, 
       int (*)(dirent**, dirent**))':
    filename_list.cxx:54: error: invalid conversion from `int (*)(const dirent**, 
       const dirent**)' to `int (*)(dirent**, dirent**)'
    
    Solution: remove the consts

    Problem with DoDragDrop and OleInitialize in fltk-1.1.4

    Solution: comment it out.

    ppeScene::load_database(ssgBranch*) is not defined?

    Solution: edit the src/Makefile and put core/libppecore.a at the end of ppe_LDADD

    g_nolods undefined:

                    //extern int g_noLoDs;
    		getBuilder() -> countGeometry ( obj, /*g_noLoDs*/ 1);
    
    

    The binary would start, but the menus did not work, so I tried fltk-1.2, plib-1.6.0, ppe

    Problem: RegisterDragDrop undefined

    fl_dnd_win32.cxx: don't include drag and drop

    Problem

    Fl_win32.cxx: comment out ifdef(GNUC) sections (3 places)

    FINALLY, ppe compiles!
    To run it, I did

    export PPE_ROOT=c:/cxh/src/ppe
    /usr/local/bin/ppe
    
    The menus work!

    2.Copy the ssgLoadMDL.cxx file to our plib installation area and overwrite our original ssgLoadMDL.cxx.


    I did:

    gunzip c:/tmp/downloads/SsgLoadMDL.cxx
    cd plib-1.6.0
    cp src/ssg/ssgLoadMDL.cxx src/ssg/ssgLoadMDL.cxx.orig
    cp c:/tmp/downloads/SsgLoadMDL.cxx src/ssg/ssgLoadMDL.cxx
    

    3.Rebuild our plib. Reinstall plib. **


    ./configure
    make
    
    Got:
    LoadMDL.cxx:1957: error: `fsTexPalette' undeclared (first use this function)
    
    
    Solution: change it to ssgFsTexPalette
            texels[c++] = ssgFsTexPalette[b*4    ];
            texels[c++] = ssgFsTexPalette[b*4 + 1];
            texels[c++] = ssgFsTexPalette[b*4 + 2];
            texels[c++] = ssgFsTexPalette[b*4 + 3];
     

    4.Rebuild our PPE. Reinstall PPE. ***

    5.Find the .bgl file that we want to convert to .ssg.

    6.Rename the *.bgl file to *.mdl

    7.Open the renamed *.mdl file in PPE

    8.In PPE menu, use "save as" to save the file as a .ssg file

    9.In FG 0.7.8, we need to put a line in a .stg file like this: *.ssg in the Scenery directory of FG. The loader is still named ssgLoadMDL.cxx, Should we rename it? Also please rename our .bgl scenery to .mdl before testing this loader. Basically, plib doesn't know what ssgLoadBGL.cxx is yet. So we pretend we are loading mdl models right now.

    The trick to build PPE is to manually run the fluidizer.py script. Without manually run the script, configure may fail in several jpeg or png libraries. We may think those libs we can ignore, but we will completely fail when compiling. The fluidizer.py script is shiped with ppe.

    ** The trick of rebuilding plib is NOT to make clean after replacing ssgLoadMDL.cxx. Instead, do a "make". GNU make will only recompile the ssgLoadMDL.cxx. Then do "make install" to install the new plib.

    *** The trick of rebuilding ppe is NOT to do "make", NOR "make claen". Instead, do the following: g

    $ cd <ppe>/<src>/
    $ c++  -g -O2 -O6 -Wall  -o ppe  ppeMad.o ppe.o ../src/gui/libppegui.a ../src/viewer/libppeviewer.a ../src/core/libppecore.a ../src/material/libppematerial.a ../src/misc/libppemisc.a ../src/fltk-extras/libppefltkextras.a ../src/structure/libppestructure.a  -lpng -lz -ljpeg -L/usr/lib/python1.5/config -L/usr/local/lib/python1.5/config -lpython1.5 -lpthread -L/usr/local/lib -L/usr/X11R6/lib -lfltk -lplibfnt -lplibssgaux -lplibssg -lplibsg -lGLU -lGL -lplibul   -L/usr/X11R6/lib -lSM -lICE -lX11 -lXi -lXext -lXmu -ldl -lm
    
    
    gcc will only "relink" ppe binaries with new plib. PPE will not be recompiled.

    Optionally, do

    $ /usr/bin/install -c  ppe /usr/local/bin/ppe
    

    To make PPE able to adjust texture coordination for each vertex. Please replace these files in the src/structure/ directory: ppeStructureGUI.fl ppeStructureView.cxx ppeStructureView.h and do "make" with in the src/structure/ directory . Then follow the procefure of rebuilding and/or reinstalling PPE.


  • BGL files for Ottawa
  • virtualplaya problems
  • bgltst shows the following problems
    ; BGLTST 2.50 analysing file:
    ; C:\cxh\src\virtualplaya\brcplan.bgl
    ;
    ID=1      40:45:59   40:44:21  -119:14:07  -119:14:07 
    VIS scenery   sect  9 ->    80
    --------
    
    Area( C   40:45:10.1997  -119:14:06.6004 100 )
    00008A: 0018: 0: destination should be a Perspective command !
    0000A2: 32 00 0E 00  2...
    
    Error count 1   Max subroutine level 2  Qmax = 4
    

  • plib loaders:
  • ssgLoadSSG - for '.ssg' files - the 'native' SSG format.
  • ssgLoadAC - for '.ac' files - a somewhat obscure format produced by the 'AC3D' modelling tool - reasonably well tried and tested.
  • ssgLoad3ds - for '.3ds' files as produced by 3DStudio.
  • ssgLoadASE - 3DSMAX ASCII EXPORT Version 2.00, well tested
  • ssgLoadDXF - AutoCADs famous DXF format. well tested
  • ssgLoadFLT - OpenFlight. Works for OpenFlight files generated by recent versions of MultiGen - but not for those generated by some other tools such as Designers' Workbench.
  • ssgLoadMD2 - Quake MD2
  • ssgLoadOBJ - Wavefront, works well
  • ssgLoadTRI - simple Tri format from "Andy Colbournes Editor".
  • ssgLoadX - Microsofts DirectX-Format. Most features work.
  • ssgLoadOFF - Geomview's OFF
  • ssgLoadM - ???
  • ssgLoadATG - Ascii TerraGear. Used by Flight Gear Flight Sim.
  • ssgLoadVRML1 - VRML1 format, only partially implemented.
  • ssgLoadIV - Inventor format, only partially implemented.
  • ssgLoadStrip - The format of a stripifier.
  • Flightgear-devel, 2002-July says:
    I just commited a new version of the BGL loader in plib. I did quite some researches on different bgl files, tried to fix some color materials issues and added some new bgl instrcutions.

    The most obvious enhancement is the support of ground layers. So when you load a BGL file you will see correctly piled gound layers (like asphalt on grass etc..) with no flickers anymore:) Some bgl models I found in the web actually consist of several bgl files. Each of them may contain some information about ground layers. If they where loaded seperately it may happen that ground layers of later loaded bgl files cover the previous ones which might be the wrong order. To overcome that problem I provide an new loader extension called "*.bgb". A bgb file is a simple ASCII file containing all bgl files for one modell. By using this you will store all bgl files in one ssgBranch and therefor you get a correct layering of the model. You can easily create a bgb file by

    %cd <to model>
    %ls *.bgl > model.bgb
    
    
    As result you get an ascii file with a bgl file in each line. You can load this bgb file like you did before with the bgl files, however the bgb and bgl files have to be in the in the same directory for loading.
  • http://cvs.sourceforge.net/viewcvs.py/plib/plib/src/ssg/ssgLoadMDL_BGLTexture.cxx
  • CVS log for ssgLoadBGL.cxx suggests that the file was removed for legal reasons?
  • ssg.cxx gets
    	 ssgAddModelFormat ( ".bgl", ssgLoadBGL , NULL ) ;
    	
  • ssg.h gets
    	ssgEntity *ssgLoadBGL  ( const char *fname, const ssgLoaderOptions *options = NULL ) ;
    	
  • Edit Makefile and add ssgLoadBGL.cxx and ssgLoadBGL.o
  • Edit ssgLoadBGL.cxx and
    	#define SSG_LOAD_BGL_SUPPORTED
    	
  • Compile
    	ssgLoadBGL.cxx:2447: error: brace-enclosed initializer used to initialize `
       char*'
    	
    Solution: Remove curly brackets:
          static char *textures[8] = { "sandstone.rgb",
                                       "white.rgb",
                                       "black.rgb",
                                       "darkgray.rgb",
                                       "gray.rgb",
                                       "whitehorizon.rgb",
                                       "sandstonehorizon.rgb",
                                       "gray.rgb" };
    	
  • 	ssgLoadBGL.cxx:2509: error: brace-enclosed initializer used to initialize `int'
    	
    Solution: Remove curly brackets:
        static int oct_faces[] =  { 8|FLOOR, 7, 6, 5,  4, 3, 2, 1, 0,
                                            4, 0, 1, 9,  8,
                                            4, 1, 2, 10, 9,
                                            4, 2, 3, 11, 10,
                                            4, 3, 4, 12, 11,
                                            4, 4, 5, 13, 12,
                                            4, 5, 6, 14, 13,
                                            4, 6, 7, 15, 14,
                                            4, 7, 0, 8,  15,
                                       8|ROOF, 8, 9, 10, 11, 12, 13, 14, 15 };
    
       ...
        static int block_faces[] = { 4|FLOOR, 3, 2, 1, 0,
                                             4, 0, 1, 5, 4,
                                             4, 1, 2, 6, 5,
                                             4, 2, 3, 7, 6,
                                             4, 3, 0, 4, 7,
                                        4|ROOF, 4, 5, 6, 7 };
    	
  • It links, but
    bash-2.05b$ ppe brc1.bgl
    Filename = ppe_undo_0000_XXXXXX
    DEBUG: [ssgLoadBGL] Reference Lat: 40.752833; Reference Lon: -119.235167 
    
    WARNING: [ssgLoadBGL] Unhandled opcode 'BGL_IFVIS' (98x)
    WARNING: [ssgLoadBGL] Unhandled opcode 'UNKNOWN 0xBC' (188x)
    FATAL: [ssgLoadBGL] Op-code out of range: 2048x
    
  • 0xBC is probably BGLVERSION, which is not defined in ssgLoadBGL.cxx or ssgLoadMDL.cxx, but the note scdis2.3:
    Ver 2.3		2003/10/19
    		Suppor following commands:
    		  BGLVersion, EndVersion, MaterialList, VertexList, TextureList,
    		  DrawTriList, DrawLineList, DrawPointList, SetMaterial,
    		  VarBaseOverride, Interpolate, Transform_Mat, TransformEnd, Animate, 
    		  I_A9, IfInF, ZBias.
    	
  • Command to rebuild
     cp ~/src/plib-1.7.0/src/ssg/libplibssg.a c:/cygwin/lib/libplibssg.a 
     cd ~/src/ppe/src; make; cp ppe.exe c:/cygwin/usr/local/bin/ppe.ex
    
  • gmax

    gmax is a 3D editing tool that comes from discreet
  • http://home.t-online.de/home/Wolfram.Kuss/Scenery/diy.txt
  • http://baron.flightgear.org/pipermail/flightgear-devel/2002-April/007106.html says:
    Interesting link. Still, I tried the MakeMDl that comes with MSFS 2002 Pro some time ago without success. The *.MDL it writes is too different, it is a new version. You might have luck with middleman, which might enable you to "intercept" the *.x file that gmax gives to MakeMDL. I did not try that.
  • Microsoft Flight Simulator 2004 SDK - Includes instructions for setting up gmax and FS
  • gmaxsupport.com Essential gmax tools