Quantcast

how to load osgearth file(*.earth) in osgscaleviewer?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to load osgearth file(*.earth) in osgscaleviewer?

lantian318
hello,

i have a problem!
i try to load a osgearth file in osgscaleviewer.
i add some code in class node. it load the osgearth model file in configInit function.
code here.part of node.cpp
 bool Node::configInit( const eq::uint128_t& initID )
    {
        if( !eq::Node::configInit( initID ))
            return false;

        Config* config = static_cast<Config*>( getConfig( ));
        if( !isApplicationNode() && !config->loadInitData( initID ))
            return false;

        _frameStamp = new osg::FrameStamp;
        _updateVisitor = new osgUtil::UpdateVisitor;
        _updateVisitor->setFrameStamp( _frameStamp );
        _contextID = 0;
#ifdef LOADEARTH
        /* BEGIN: Added by frankz, 2014/8/14   PN:1 */
        // load mode here
        osg::Node* osg_node = 0L;
        char** filename = new char *[10];
        filename[0] = "D:\\code\\osgearth-osgearth-2.5\\osgearth-osgearth-2.5\\tests\\feature_geom.earth";
        int itemp = 1;
        osg::ArgumentParser arguments(&itemp,filename);
		LBINFO << "earth file" << arguments[0];

        osg_node = osgDB::readNodeFile( arguments[0] );

        if( !osg_node )
        {
            LBINFO << "No earth file" ;
            LBERROR << "Load earth file failed";
        }
        osg::ref_ptr<MapNode> mapNode = MapNode::get(osg_node);
        if ( !mapNode.valid() )
        {
            LBINFO << "Loaded scene graph does not contain a MapNode - aborting" ;
            return false;
        }

        //root node to hold everything:
        osg::ref_ptr< osg::Group > root = new osg::Group();
//        osg::Group* root = new osg::Group();
        root->addChild( mapNode.get() );
        _model = root;
		return true;
        /* END:   Added by frankz, 2014/8/14   PN:1 */

#else

it run normally. But i can't find the earth model in window.

What causes it?

Thanks!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to load osgearth file(*.earth) in osgscaleviewer?

Robert Hauck
Hi

I don't know it it is still open, if yes:

- Do you use just the osgScaleViewer and added those lines?
   -> If yes, I suggest to have a look at eqEarth for example, https://github.com/dardok/eqEarth.

- An error message would be useful....

- as it should load world.tif, those are geo-referenced files, so do you have and use GDAL etc.?

Cheers,
Robert
Loading...