Overview of Using vtlib for Terrain

Here is a high-level introduction to using vtlib to render your terrain data.

Preparing Data

  1. Prepare your data.
    You should have, at the minimum, elevation data.
  2. Put the data in the correct location.
    BT, ITF, and Tileset .ini files should be put in a folder called "Elevation" under your data directory.
    Imagery should be in a folder "GeoSpecific"  under your data directory.
  3. Create a set of parameters describing your terrain.
    An easy way is to copy one of the sample files, found in <datapath>/Terrains
    These are plain text files which are easy to edit. 
    E.g. call yours "MyTerrain.xml".  Edit it to contain the filenames of your own data.

Build Environment

  1. Make sure the necessary directories on are your include path.  If you compiled vtlib, then you already have everything set up to compile applications on top of it.

Your application will create the OpenGL context.  vtlib will simply draw into the current context each frame.

Initialization code

  1. A vtScene object already exists globally.  Get a handle to it and initialize it:
  2. Set your global data path, for example:
  3. Create a vtTerrainScene object.  This will contain any number of individual terrain.
  4. Attach to the scene graph:
  5. Load and create the vtTerrain object:
  6. Optionally add a mouse navigation engine, so the user can fly over the terrain.

Runtime code

  1. In the main loop of your code, let vtlib do its culling and rendering: