Horde3D

Next-Generation Graphics Engine
It is currently 27.04.2024, 12:46

All times are UTC + 1 hour




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: 24.03.2010, 20:05 
Offline

Joined: 15.06.2008, 11:21
Posts: 166
Location: Germany
Just compute speedOffset using the system time of the last frame and the current system time. If you are using glfw, a simple function would be glfwGetTime(), if not, gettimeofday/QueryPerformanceCounter probably is the way to go.

Code:
double lastframetime = glfwGetTime();
while (!stopped)
{
    double time = glfwGetTime();
    speedOffset += (time - lastframetime) * _speed;
    lastframetime = time;
    // Update and render here
}


Top
 Profile  
Reply with quote  
PostPosted: 25.03.2010, 10:47 
Offline

Joined: 17.11.2009, 17:00
Posts: 205
Location: Russia, Moscow
Thanks for the code, but unfortunately it has the same problem as my code. There is still a noticable jump when frames become 60 from 30 and vice verse. It seems that I somehow have to predict the acceleration (decceleration) of the frames, but how to do that?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 34 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group