Hi,

I'd like to know what would be the difference between:
viewer.getViewerFrameStamp()->getReferenceTime();

and 
osg::Timer::instance()->delta_m(startTick,endTick)

in the following codes:


Code:

int main( int argc, char** argv )
{
        /* Add models to the scene */
        osg::ref_ptr<osg::Node> model = osgDB::readNodeFile( "cessna.osg" );

        if(model == NULL)
        {
                osg::notify( osg::FATAL ) << "Unable to load data file. 
Exiting." << std::endl;
                return 1; 
        }

        /* create the scene graph */
        osg::ref_ptr<osg::Group> root = new osg::Group;
        root->addChild( model.get() );

        /* view the scene */
        osgViewer::Viewer viewer;

        /* set scene data */
        viewer.setSceneData( root.get() );

        // take start time
        osg::Timer_t startTick = osg::Timer::instance()->tick();

                // Run the viewer
        viewer.run();
        
        
        // take the end of time after viewing 
        osg::Timer_t endTick = osg::Timer::instance()->tick();
        
        // time elapsed since osgviewer started running and the model is 
displayed on the screen
        double t = viewer.getFrameStamp()->getReferenceTime();

        //display elapsed times
        cout << " With osg::Timer_t, completed in 
"<<osg::Timer::instance()->delta_m(startTick,endTick)<< " milliseconds" <<endl;
        cout << " With viewer.getFrameStamp()->getReferenceTime = " << t*1000 
<< " milliseconds" << endl;

}




I got very different values, e.g.:

With osg::Timer_t = 2036.44 ms
With viewer.getFrameStamp() = 1887.5 ms

Thank you very much,

Maia


robertosfield wrote:
> Hi Utkarsh,
> 
> viewer.getViewerFrameStamp()->getReferenceTime();
> 
> Robert.
> 
> On 2 May 2012 17:27, Utkarsh Patankar <> wrote:
> 
> > Hi,
> > 
> > In an OSG application, is there any way to find out how much time has 
> > elapsed since osgviewer started running? I don't want to use any external 
> > time based functions.
> > 
> > Thank you!
> > 
> > Cheers,
> > Utkarsh
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=47508#47508
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum

Code:




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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to