Re: [osg-users] Monitoring time elapsed

2012-06-12 Thread Maia Randria
Hi Robert,

Sorry for bothering you with this but I think I don't really understand how to 
use viewer.advance() with viewer.getFrameStamp()-getReferenceTime(). Could you 
give an example, please ?

In fact, what I would want to do is to compute and record the elapsed time 
between the time a scene is rendered on the screen ( i.e., the time at which 
the user is viewing the scene) and an event (e.g. the user is clicking on an 
object on the viewport).

Thank you,

Maia

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





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


Re: [osg-users] Monitoring time elapsed

2012-06-12 Thread Robert Osfield
Hi Maia,

On 12 June 2012 15:50, Maia Randria
veneree.randrianari...@crulrg.ulaval.ca wrote:
 Sorry for bothering you with this but I think I don't really understand how 
 to use viewer.advance() with viewer.getFrameStamp()-getReferenceTime(). 
 Could you give an example, please ?

Go have a look at the source code in the examples and the OSG code
base, use a search on FrameStamp.

 In fact, what I would want to do is to compute and record the elapsed time 
 between the time a scene is rendered on the screen ( i.e., the time at which 
 the user is viewing the scene) and an event (e.g. the user is clicking on an 
 object on the viewport).

The events have a time stamp, as does the event visitors and viewer.

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


Re: [osg-users] Monitoring time elapsed

2012-06-12 Thread Maia Randria
OK, I will do so, thank you very  much.
Maia


robertosfield wrote:
 Hi Maia,
 
 On 12 June 2012 15:50, Maia Randria
  wrote:
 
  Sorry for bothering you with this but I think I don't really understand how 
  to use viewer.advance() with viewer.getFrameStamp()-getReferenceTime(). 
  Could you give an example, please ?
  
 
 Go have a look at the source code in the examples and the OSG code
 base, use a search on FrameStamp.
 
 
  In fact, what I would want to do is to compute and record the elapsed time 
  between the time a scene is rendered on the screen ( i.e., the time at 
  which the user is viewing the scene) and an event (e.g. the user is 
  clicking on an object on the viewport).
  
 
 The events have a time stamp, as does the event visitors and viewer.
 
 Robert.
 ___
 osg-users mailing list
 
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
 
  --
 Post generated by Mail2Forum


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





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


Re: [osg-users] Monitoring time elapsed

2012-06-11 Thread Maia Randria
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_ptrosg::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_ptrosg::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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Monitoring time elapsed

2012-06-11 Thread Robert Osfield
Hi Maia,

The FrameStamo::getReferenceTime() is the reference time for the
current frame, it's updated during the viewer.advance() and isn't
updated till the next advance().  advance() is called as the first
part of the viewer.frame().

Robert.

On 11 June 2012 19:12, Maia Randria
veneree.randrianari...@crulrg.ulaval.ca wrote:
 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_ptrosg::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_ptrosg::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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Monitoring time elapsed

2012-06-11 Thread Maia Randria
OK, thank you very much.
Maia


robertosfield wrote:
 Hi Maia,
 
 The FrameStamo::getReferenceTime() is the reference time for the
 current frame, it's updated during the viewer.advance() and isn't
 updated till the next advance().  advance() is called as the first
 part of the viewer.frame().
 
 Robert.
 
 On 11 June 2012 19:12, Maia Randria
  wrote:
 
  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_ptrosg::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_ptrosg::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
  
  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


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





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


[osg-users] Monitoring time elapsed

2012-05-02 Thread Utkarsh Patankar
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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Monitoring time elapsed

2012-05-02 Thread Robert Osfield
Hi Utkarsh,

viewer.getViewerFrameStamp()-getReferenceTime();

Robert.

On 2 May 2012 17:27, Utkarsh Patankar osgfo...@tevs.eu 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
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org