OpenGl glutIdleFunc(void (*func)(void))
我正在尝试在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.