更改 GLUT 调用以与 MFC/C++ 一起使用
我有一个使用 GLUT 进行 OpenGL 渲染的程序。现在我需要它位于 MFC 项目内部,以便它可以与另一个程序组件一起使用。
当计时器触发时,我正在调用作为 GLUT 显示回调的函数,但这不起作用,因为渲染取决于 GLUT 空闲回调中发生的事情。我不明白应该在 MFC 程序中的哪里调用 GLUT 空闲回调。我是否应该为其创建一个单独的事件处理程序,如果是,是哪个事件?或者我做了其他完全错误的事情?我对 OpenGL 相当熟悉,但这是我第一次使用 MFC,所以我可能在这方面犯了错误。
非常感谢您抽出时间;我真的很感激!
I have a program that uses GLUT for its OpenGL rendering. Now I need it to be inside of a MFC project so that it can work with another program component.
I've followed this tutorial: http://www.codeguru.com/cpp/g-m/opengl/openfaq/article.php/c10975__1/Setting-Up-OpenGL-in-an-MFC-Control.htm
I am calling the function that was the GLUT display callback when the timer fires, but that's not working because the rendering depends on something that happens in the GLUT idle callback. I don't understand where I should call the GLUT idle callback in my MFC program. Is there a separate event handler I should make for it, and if so, which event? Or am I doing something else completely wrong? I'm fairly familiar with OpenGL but this is my first experience with MFC so I am probably erring on that side.
Thanks so much for your time; I really appreciate it!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我刚刚浏览了您链接到的教程;在第二页上,可以找到以下内容(我稍微清理了代码):
所以,基本上这是教程建议的 glutIdleFunc 的替代品。我只是尝试在调用
SwapBuffers
之前插入在空闲函数中调用的代码。我希望这有帮助。
I just browsed the tutorial you've linked to; on page two, something along the following lines can be found (I cleaned up the code a little bit):
So, basically this is the replacement for
glutIdleFunc
suggested by the tutorial. I'd simply try to insert the code called in your idle function before the call toSwapBuffers
.I hope that helps.