Hi, I've been migrating some code from OSG 0.9.9 to the latest stable release (2.8.3), and I've run into an issue when migrating from OSGProducer::viewer to OsgViewer::viewer. I have three models, an airplane.3ds model, a sky.3ds model, and a globe.osga model. All three models load correctly (the nodes returned from osgDB::readNodeFile are not NULL), but only the airplane model shows up when the viewer display is rendered.
The only functions that I needed to change from osgProducer to osgViewer were my initialization and update functions. I've made sure to replace osgProducer calls with equivalent osgViewer calls when I upgraded (see code below), but is there anything I might have missed? Code: 3DPlaneViewer::Initialize(){ osgViewer::Viewer* viewer = new osgViewer::Viewer(); //scene root osg::Group* root = new osg::Group(); //load globe and add transform of globe to root group osg::Node* globeNode = osgDB::readNodeFile("globe.osga"); osg::MatrixTransform* globeTransform = new osg::MatrixTransform(); globeTransform->addChild( globeNode ); //create group for globe and sky osg::Group*terrainNodes = new Group(); terrainNodes->asGroup()->addChild( globeTransform ); //load airplane osg::Node* airplaneNode = osgDB::readNodeFile("airplane.3ds"); //specify a location for plane on globe with lat, long, altitude osg::Matrixd airplaneMatrix; osg::EllipsoidModel* ellipse->computeLocalToWorldTransformFromLatLongHeight( osg::DegreesToRadians(20.0f),osg::DegreesToRadians(-30.0f), 15000,airplaneMatrix ); //rotate airplane node airplaneMatrix.preMult( airplaneMatrix.rotate( osg::Quat(osg::DegreesToRadians(180.0f), osg::Vec3f( 0, 0, 1 ) ))); //setup matrix wrapper node osg::MatrixTransform* airplaneTransform = new osg::MatrixTransform(); airplaneTransform->getOrCreateStateSet()->setMode(GL_RESCALE_NORMAL,osg::StateAttribute::ON); airplaneTransform->setMatrix(airplaneMatrix); airplaneTransform->addChild( airplaneNode ); terrainNodes->asGroup()->addChild( airplaneTransform ); //load and add the sky model osg::Node* skyNode = osgDB::readNodeFile("sky.3DS"); osg::MatrixTransform* skyTransform = new osg::MatrixTransform(); skyTransform->addChild( skyNode ); terrainNodes->asGroup()->addChild( skyTransform ); root->addChild( terrainNodes ); //realize the scene in the viewer viewer->setSceneData(root); viewer->realize(); } 3DPlaneViewer::Update() { //removed calls to osgProducer::sync() viewer->updateTraversal(); //do some other updates on other objects in the scene viewer->frame(); } Thanks, John ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=32136#32136 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org