Hi J-S,

Thanks for the reply. Well what i needed was to provide the setMatrix() method 
with a Geometry. i mean to be able to use setMatrix when vertices are 
specified. i was just complicating it.

osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
mt->addChild(pyramidGeode); // pyramidGeode is a Geode pointer.

PS: Could you please tell me what is wrong with this code:


Code:

int main()
{
        
        // graph created above.
        osgViewer::Viewer viewer;

        // Set the projection matrix.
        viewer.getCamera()->setProjectionMatrixAsFrustum(-2, 2, 
                                                                                
                         -2, 2,
                                                                                
                          2, 1000);

        osg::Node* cow  = osgDB::readNodeFile( "JoeDirt.flt" );
        
        // Cow node
        osg::ref_ptr<osg::MatrixTransform> mt = new osg::MatrixTransform;
        mt->addChild(cow);
        mt->setDataVariance( osg::Object::DYNAMIC );
        
        osg::ref_ptr<osg::Group> root = new osg::Group;
        
        // add child
        root->addChild( mt.get() );
        
        // set the scene data
        viewer.setSceneData( root.get() );
        
        // Set the clear color 
        viewer.getCamera()->setClearColor(
        osg::Vec4( 0., 0., 0., 1. ) );

        double angle = 0;
        while (!viewer.done()) {
                // Create the rotation matrix.
                osg::Matrix rot1, scale1, trans1;
        
                // Set the matrix for the cow.  
                 rot1.makeRotate( angle += 0.01, osg::Vec3( 1., 0., 0. ) );     
        
                 trans1.makeTranslate(osg::Vec3(-2, -2, -500));

                 // rotate the model
                 mt->setMatrix(rot1 *  trans1);         
        
                // Draw the next frame.
                viewer.frame();
        }

        return 0;
}




The terrain loads and rotates fine. But when it comes to the horizontal plane(0 
degrees), the model vanishes(part of it). What could be the problem?

Thanks, 
Mukund

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=36155#36155





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to