Box2D 和 glut。帧率问题
我在让 glutTimerFunc() 与 box2d 的 world->step(); 很好地配合时遇到问题
以下是我传递给它们的值。
glutTimerFunc(0, timer, 0);
world->Step((1.0f/60.0f), 8, 6);
问题是,当timerFinc为0时,图形没有时间正确渲染,因此我的图形变得跳跃。如果我将任何其他值传递给timerFunc,我的图形基本上就会停止,无论是1、20还是之间的任何值。我也无法将其他值传递到 world->step 中,否则事情会变得非常混乱。
有什么办法可以让两者一起运行吗?或者也许我错过了一些东西。
I am having problems getting glutTimerFunc() to play nicely with box2d's world->step();
Here are the values I'm passing into them
glutTimerFunc(0, timer, 0);
world->Step((1.0f/60.0f), 8, 6);
The problem with this is that with the timerFinc at 0 the graphics don't have time to render properly so my graphics become jumpy. If I pass any other value into timerFunc my graphics basically come to a standstill be it 1, 20 or any value in between. I also can't pass other values into world->step without things getting very messy.
Is there some way I can get the two to run together. Or maybe I'm missing something.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您有严格的计时需求,例如游戏或物理模拟,则根本不应该使用 FreeGLUT。尝试使用GLFW。它允许您手动管理渲染循环,因此您可以完全控制时间。
If you have strict timing needs, such as for a game or physics simulation, you should not be using FreeGLUT at all. Try GLFW instead. It allows you to manage the rendering loop manually, and thus, you have full control over timing.