changing GLUT calls to work with MFC/C++

半腔热情 提交于 2019-12-05 21:36:36

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):

void COpenGLControl::OnTimer(UINT nIDEvent)
{
   if(nIDEvent==1)
   {
         glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);    
         oglDrawScene();
         // try to insert your idle function code here
         SwapBuffers(hdc);    
   }
   CWnd::OnTimer(nIDEvent);
}

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 to SwapBuffers.

I hope that helps.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!