Hi Jason,
In fact, I create the map through program.What the program does is that as and
when some new tif file arrives at particular folder which I am monitoring
continuously thru callback, I add the file to the already created map. It works
well for some 2-3 tile addition. When it goes beyond that it throws the openGL
error. Have a look at my code. Is there any other way to do the same.
Akilan. A
Code:
....
class monitorCallback : public osg::NodeCallback
{
public:
monitorCallback(osgEarth* map)
{
_map=map;
}
virtual void operator()(osg::Node* node, osg::NodeVisitor* nv)
{
//
// look for any new tif arrival at specific folder
//
.....
.....
if(new_tif)
{
sprintf(name, "tile_%d", tif_cnt);
osgEarth::Config conf;
conf.add("url", new_tif);//new tif name with relative
path
_map->addMapLayer( new osgEarth::MapLayer(name,
osgEarth::MapLayer::TYPE_IMAGE, "gdal", conf ) );
}
}
osgEarth::Map* _map;
};
int main(int argc, char* argv[])
{
_chdir(curr_dir);
osgViewer::Viewer* viewer=new osgViewer::Viewer;
osg::Group* root=new osg::Group;
osgEarth::Map* map = new
osgEarth::Map(osgEarth::Map::CSTYPE_GEOCENTRIC);
// Cache
map->setCache(new TMSCache("cache"));
// World
{
osgEarth::Config conf;
conf.add( "url", "../data/world.tif" );
map->addMapLayer( new osgEarth::MapLayer("WORLD",
osgEarth::MapLayer::TYPE_IMAGE, "gdal", conf ) );
}
root->setUpdateCallback(new monitorCallback(map));
osgEarth::MapNode* mapNode=new osgEarth::MapNode(map);
mapNode->setNodeMask( 0x01 );
viewer->setCameraManipulator(new osgEarthUtil::EarthManipulator);
viewer->addEventHandler( new osgViewer::StatsHandler() );
viewer->addEventHandler( new osgViewer::ThreadingHandler() );
viewer->setSceneData(root);
viewer->run();
return 0;
}
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=27417#27417
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org