Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualIndloon

Posted 02 February 2013 - 08:52 AM

Here's a function that I have been using on Linux with GLUT.

 

int frameCount = 0;
int currentTime = 0;
int previousTime = 0;
float fps = 0;
 
...
 
void GetFPS( void )
{
    frameCount++;
    currentTime = glutGet( GLUT_ELAPSED_TIME );
    int timeInterval = currentTime - previousTime;
 
    if( timeInterval > 1000 )
    {
        fps = frameCount / ( timeInterval / 1000.0f );
        previousTime = currentTime;
        frameCount = 0;
    }
}
 
...
 

 

I call GetFPS function after the model gets animated, but _BEFORE_ calling display function( drawing a frame ).

 

And some futher reading, if you're interested: http://fabiensanglard.net/timer_and_framerate/index.php


#3Indloon

Posted 02 February 2013 - 08:49 AM

Here's a function that I have been using on Linux with GLUT.
int       frameCount = 0;int       currentTime = 0;int       previousTime = 0;float     fps = 0;...void GetFPS( void ){    frameCount++;    currentTime = glutGet( GLUT_ELAPSED_TIME );    int timeInterval = currentTime - previousTime;    if( timeInterval > 1000 )    {        fps = frameCount / ( timeInterval / 1000.0f );        previousTime = currentTime;        frameCount = 0;    }}...

I call GetFPS function after the model gets animated, but _BEFORE_ calling display function( drawing a frame ).

Some futher reading, if you're interested: http://fabiensanglard.net/timer_and_framerate/index.php

#2Indloon

Posted 02 February 2013 - 08:49 AM

Here's a function that I have been using on Linux with GLUT.
int       frameCount = 0;int       currentTime = 0;int       previousTime = 0;float     fps = 0;...void GetFPS( void ){    frameCount++;    currentTime = glutGet( GLUT_ELAPSED_TIME );    int timeInterval = currentTime - previousTime;    if( timeInterval > 1000 )    {        fps = frameCount / ( timeInterval / 1000.0f );        previousTime = currentTime;        frameCount = 0;    }}...

I call GetFPS function after the model gets animated, but _BEFORE_ calling display function( drawing a frame ).

Some futher reading, if you're interested: http://fabiensanglard.net/timer_and_framerate/index.php

#1Indloon

Posted 02 February 2013 - 08:48 AM

Here's a function that I have been using on Linux with GLUT.

int       frameCount = 0;
int       currentTime = 0;
int       previousTime = 0;
float    fps = 0;


...

void GetFPS( void )
{
    frameCount++;
    currentTime = glutGet(GLUT_ELAPSED_TIME);
    int timeInterval = currentTime - previousTime;

    if( timeInterval > 1000 )
    {
        fps = frameCount / ( timeInterval / 1000.0f );
        previousTime = currentTime;
        frameCount = 0;
    }
}

...

 

I call GetFPS function after the model gets animated, but _BEFORE_ calling display function( drawing a frame ).

 

Some futher reading, if you're interested: http://fabiensanglard.net/timer_and_framerate/index.php


PARTNERS