刷新 GLUT 窗口
请原谅我糟糕的英语。
我正在使用 OpenGL、GLUT 和 C++ 开发一个程序,用于在窗口周围移动多边形块。嗯,首先我使用了 GLUT 计时器功能,它工作得很好。现在,我想实现自己的计时器,所以我写了一个。但是当我在同一个文件中使用它时,动画运行速度非常慢。计时器创建一个线程来执行移动块的函数,我认为问题是 glutPostRedisplay 不会自动刷新窗口,并且计时器继续调用这些函数,而不考虑窗口是否真正更新。
我的问题是,这是问题所在吗?怎么解决呢?
如果有必要,我可以发布代码,但是太大并且难以阅读......
谢谢。
Please, excuse my bad english.
I'm developing a program with OpenGL, GLUT and C++ that moves a block of polygons around the window. Well, first I used the GLUT timer function and it works fine. Now, I want to implement my own timer, so I wrote one. But when I use it in the same file, the animation works so slow. The timer create a thread to execute the function to move the block and I think the problem is that glutPostRedisplay don't refresh automatically the window and the timer continues doing calls to these function without consider if the winow was really updated or not.
My question is, is this the problem? How can solve it?
If is necesary, I can post the code, but is so large and hard to read...
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
glutPostRedisplay 仅设置表示窗口需要更新的标志,更新将在 glutSwapBuffers 之后发生。
glutPostRedisplay only sets the flag that means window needs to be updated, update will happen after glutSwapBuffers.