GeoPeeker 发表于 2017-12-1 16:29:26

请教一下为什么将节点写成ive文件时出错

        const osgEarth::SpatialReference* latLong = osgEarth::SpatialReference::get("wgs84");
        osgEarth::GeoPoint gpt(latLong, 110, 34, 0);
        osg::Image* city = osgDB::readImageFile("../../icons/city.png");
        osgEarth::Style style;
        style.getOrCreateSymbol<osgEarth::Symbology::TextSymbol>();
        osgEarth::Annotation::PlaceNode* pn = new osgEarth::Annotation::PlaceNode(NULL, gpt, city, "China", style);
        // 下面两种方式写ive都出错
        osgDB::Registry::instance()->writeNode(*pn, "F:/testChina.ive", osgDB::Registry::instance()->getOptions());
        //osgDB::writeNodeFile(*pn, "F:/testLod.ive", osgDB::Registry::instance()->getOptions());

其中city.png就是个图片。
无论我使用哪种方式都无法正确将osgEarth::Annotation::PlaceNode节点输出到ive文件,错误是:Error writing IVE image: StateSet::write(): Unknown StateAttribute: VirtualProgram

GeoPeeker 发表于 2017-12-1 16:31:14

对了,我用的事osg3.4+osgEarth2.8。

GeoPeeker 发表于 2017-12-4 17:10:32

我跟踪了一下,好像ive不支持PlaceNode节点的读写,如果需要,怎么能让它支持呢?有没有大咖来告诉一下解决办法?

ago 发表于 2017-12-5 16:13:04

osgEarth::Annotation::PlaceNode是osgEarth扩展的节点,超出了osg支持的范围

GeoPeeker 发表于 2017-12-6 07:34:56

ago 发表于 2017-12-5 16:13
osgEarth::Annotation:laceNode是osgEarth扩展的节点,超出了osg支持的范围

但是论坛里那个osgEarth35讲的视频里清清楚楚地用了写入PlaceNode节点:
      osgEarth::Annotation::PlaceNode* pn = new osgEarth::Annotation::PlaceNode(osg->mapNode, osg::Vec3d(lon, lat, 0), tempImg, wname, osg->style);
      osgDB::Registry::instance()->writeNode(*pn, outputPath , osgDB::Registry::instance()->getOptions());      

我不知道为什么他osg3.0+osgEarth2.1居然可以。
页: [1]
查看完整版本: 请教一下为什么将节点写成ive文件时出错