- if (!is_running_) break;
-
- int i = 0;
- while (nextUpdate < timer::ticks() && i < MAX_FRAMESKIP)
- {
- totalTime += timestep; // 3. update state
- view_.update(totalTime, timestep);
-
- nextUpdate += timestep;
- ++i;
-
- if (!is_running_) break;
- }
-
- if (nextDraw < (ticks = timer::ticks()))
- {
- view_.draw(
- (ticks + timestep - nextUpdate) * inverseTimestep);
- video_->swap(); // 4. draw state
-
- nextDraw += framerate;
- ++frameCount;
-
- if (nextSecond < timer::ticks())
- {
- fps_ = frameCount;
- frameCount = 0;
+ //if (!is_running_) break;
+
+ //int i = 0;
+ //while (nextUpdate < timer::ticks() && i < MAX_FRAMESKIP)
+ //{
+ //totalTime += timestep; // 3. update state
+ //view_.update(totalTime, timestep);
+
+ ////previous = current;
+ ////integrate(current, totalTime, timestep);
+
+ //nextUpdate += timestep;
+ //++i;
+
+ //if (!is_running_) break;
+ //}
+
+ ////const float newTime = timer::ticks();
+ ////float deltaTime = newTime - currentTime;
+ ////currentTime = newTime;
+
+ ////if (deltaTime>0.25f)
+ ////deltaTime = 0.25f;
+
+ ////accumulator += deltaTime;
+
+ ////while (accumulator>=dt)
+ ////{
+ ////accumulator -= dt;
+ ////previous = current;
+ ////integrate(current, t, dt);
+ ////t += dt;
+ ////}
+
+ ////if (nextDraw < (ticks = timer::ticks()))
+ ////{
+ //ticks = timer::ticks();
+ //scalar diff = ticks - nextDraw;
+ ////log_info("difference:", diff);
+ //scalar alpha = (ticks + timestep - nextUpdate) * inverseTimestep;
+ ////scalar alpha = (nextUpdate - ticks) * inverseTimestep;
+ ////float alpha = accumulator/dt;
+ //if (alpha < SCALAR(0.0)) log_error("UH OH!!!!! It's NEGATIVE", alpha);
+ //if (alpha > SCALAR(1.0)) log_error("UH OH!!!!! It's POSITIVE", alpha);
+ //log_info("alpha:", alpha);
+
+ //view_.draw(alpha);
+
+ //// TEMP
+ ////State state = interpolate(previous, current, alpha);
+ ////glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ ////glBegin(GL_POINTS);
+ ////glColor3f(1,1,1);
+ ////glVertex3f(state.x, 0, 0);
+ ////glEnd();
+
+
+
+ //video_->swap(); // 4. draw state
+
+ //nextDraw += framerate;
+ //++frameCount;
+
+ //if (nextSecond < ticks)//timer::ticks())
+ //{
+ //fps_ = frameCount;
+ //frameCount = 0;
+
+ //if (show_fps_) log_info << fps_ << " fps" << std::endl;
+
+ //nextSecond += SCALAR(1.0);
+ //}
+ ////}