Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // was:
- if (this->simulator != 0) {
- int deltaTime = min(max(glutGet(GLUT_ELAPSED_TIME) - this->previousTicks, 0), 1000);
- this->accumulator += deltaTime / 1000.0f;
- float timeStep = 1.0f / 62.5f;
- while (this->accumulator > timeStep) {
- this->simulator->step(timeStep);
- this->accumulator -= timeStep;
- }
- Drawer::getInstance()->drawSimulation();
- this->previousTicks = glutGet(GLUT_ELAPSED_TIME);
- }
- // should be:
- if (this->simulator != 0) {
- int currentTicks = glutGet(GLUT_ELAPSED_TIME);
- int deltaTime = min(max(currentTicks - this->previousTicks, 0), 1000);
- this->accumulator += deltaTime / 1000.0f;
- float timeStep = 1.0f / 62.5f;
- while (this->accumulator > timeStep) {
- this->simulator->step(timeStep);
- this->accumulator -= timeStep;
- }
- Drawer::getInstance()->drawSimulation();
- this->previousTicks = currentTicks;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement