Dear Robert,
Thank for your answer. One more question. Right now I have my code like this:

numOfFrame = 0;
startTime = time(NULL);
while (!viewer.done())
{
   viewer.frame();
   numOfFrame ++;
}
endTime = time(NULL);
frameRate = (double)numOfFrame/(endTime - startTime);

But it always gives me about 60fps. Did I make a mistake somehow?
(startTime and endTime are in seconds already)
Thanks,
Dat

On Mon, Dec 21, 2009 at 3:17 AM, Robert Osfield
<[email protected]> wrote:
> Hi Dat,
>
> On Sun, Dec 20, 2009 at 8:26 PM, Nguyen Tien Dat <[email protected]> wrote:
>> Dear all,
>> Could you tell me a way to get the average frame rate after, for
>> example, 1 minute of running?
>
> The OSG itself doesn't give you this but it gives you all the tools to
> do it.  You have an osg::Timer for the time, and your have control
> over the frame loop so you can count the frames - so you can just do
> it yourselves for all th timings.  There is even an FrameStam
> viewer.getFrameStamp() that gives you the ReferenceTime and
> FrameNumber, see include/osg/FrameStamp for further details, if you
> just want to use the OSG built in timing/frame counting.
>
> All is left is a programming question... how do you computer averages
> over a specified period.  This is something I would expect most
> computer graphics programmers to be able to do.
>
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



-- 
Dat Tien Nguyen
PhD student, Computer Science Department
The University of Iowa, IA 52242
http://cs.uiowa.edu/~tinguyen
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to