Skip to content

Current step function may not deliver 30 frames a second #1

Description

@dash-rai
void step(){
  float m=glutGet(GLUT_ELAPSED_TIME)/(1.0/30.0);
  if(floor(m)==m){//If the time is a multiple of 1/30 th of a second, redisplay
    world->Step(1.0/30.0,8,3);
    glutPostRedisplay();
  }
}

Worst Case: The function may execute in a way that the elapsed time is never a multiple of 1/30th of a second.
1/30th of a second = ~33ms
step() maybe called once at elapsed time = 31ms and then at 34ms.
Redisplay will not be called in that case. This may cause a drop in refresh rates.

Also, wouldn't if (!(glutGet(GLUT_ELAPSED_TIME) % 33)) be a better solution if the lowered refresh rate is a non-issue?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions