Hi, all.

Source file and header in archive.
To use a class a compass:

osg::ref_ptr<osg::Node> node = osgDB::readNodeFile("arrow.osgb"); // any node 
looking to the north
        if(node.valid())
        {
                node->getOrCreateStateSet()->setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );
        }
        osg::ref_ptr<osg::PositionAttitudeTransform> pos = new 
osg::PositionAttitudeTransform;
        pos->addChild(node.get());
        pos->setScale(osg::Vec3(0.6,0.6,0.6));


        osg::ref_ptr<Compass> compass = new Compass;
    compass->setViewport( 0.0, 0.0, 100.0, 100.0 );
        compass->setProjectionMatrix( osg::Matrixd::identity() );
    compass->setNeedle( pos.get() );
    compass->setMainCamera( VIEWER->getCamera() );
    
    compass->setRenderOrder( osg::Camera::POST_RENDER );
    compass->setClearMask( GL_DEPTH_BUFFER_BIT );
    compass->setAllowEventFocus( false );
    compass->setReferenceFrame( osg::Transform::ABSOLUTE_RF );
    compass->getOrCreateStateSet()->setMode( GL_LIGHTING, 
osg::StateAttribute::OFF );
    compass->getOrCreateStateSet()->setMode( GL_BLEND, osg::StateAttribute::ON 
);

        root->addChild( compass.get() );


Good luck!

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



Attachment: Compass.7z
Description: Binary data

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

Reply via email to