OpenGl glutIdleFunc(void (*func)(void))

发布于 2024-08-26 21:06:14 字数 139 浏览 2 评论 0原文

我正在尝试在 OpenGL 中设计非常简单的动画,例如旋转和平移对象。 在红书中,我发现使用GLUT的glutIdleFunc()对于简单的动画来说是可以的。

glutIdleFunc(...) 一秒钟内调用该函数多少次?

谢谢。

I'm trying to design very simple animation in OpenGL such as rotating and translating objects.
In the red book, I found that using GLUT's glutIdleFunc() is okay for a simple animation.

How many times does glutIdleFunc(...) call the function in one second?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

丑丑阿 2024-09-02 21:06:14

glutIdleFunc 是“未接收到事件时持续调用” 。更新速度在很大程度上取决于您运行的系统,并且会随着程序的生命周期而变化,因为当正在接收到事件时,它会减慢甚至停止被调用。

然而,在典型的窗口应用程序中,它会被定期调用以提供合理的行为。但是,如果您想要恒定的旋转/平移速度,则需要实现自己的计时来保持速度恒定。

glutIdleFunc is "continuously called when events are not being received". The update speed depends heavily on the system on which you are running, and will vary over the lifetime of the program, since it will slow down or even stop being called as events are being received.

In a typical windowed application, though, this gets called regularly enough to provide reasonable behavior. However, if you want a constant speed for rotation/translation, you'll need to implement your own timing to handle keeping the speed constant.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文