|
开发环境已经搭建好了,写了个小例子 是osgearth里的一个例子, 原代码 添加的是链接 运行起来就是个白球,想读取.earth文件, 不知该如何操作。
示例代买如下:
osgEarth::Map* map=new Map();
//osgEarth:rivers::TMSOptions imagery;
osgEarth::Drivers::GDALOptions gdal;
gdal.url()="D:\OSG\osgEarth\sky_rendering.jpg";
imagery.url() = "D:\OSG\osgEarth\sky_rendering.jpg";
map->addImageLayer( new ImageLayer("Imagery", gdal) );
//add a TMS elevation layer:
TMSOptions elevation;
elevation.url() = "D:\zk\20120319\igis_sdk\data\ive\data.ive";
map->addElevationLayer( new ElevationLayer("Elevation", elevation) );
osgEarth::MapNode* node = new MapNode(map);
osgViewer::Viewer viewer;
viewer.setCameraManipulator(new EarthManipulator);
viewer.setSceneData(node);
viewer.getDatabasePager()->setDoPreCompile(true);
viewer.addEventHandler(new osgViewer::StatsHandler());
viewer.addEventHandler(new osgViewer::WindowSizeHandler());
viewer.addEventHandler(new osgViewer::ThreadingHandler());
viewer.addEventHandler(new osgViewer:ODScaleHandler());
viewer.addEventHandler(new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet())); |
|