|
- void CJuly9_View::OnInitialUpdate()
- {
- CView::OnInitialUpdate();
- m_osg->InitOSG("cessna.osg");
- m_ThreadHandle = (HANDLE)_beginthread(&cOSG::Render,0,m_osg);
- }
复制代码
- void cOSG::Render(void* ptr)
- {
- cOSG* osg = (cOSG*)ptr;
- osgViewer::Viewer* viewer = osg->getViewer();
- // You have two options for the main viewer loop
- // viewer->run() or
- // while(!viewer->done()) { viewer->frame(); }
- //viewer->run();
- while(!viewer->done())
- {
- osg->PreFrameUpdate();
- viewer->frame();
- osg->PostFrameUpdate();
- //Sleep(10); // Use this command if you need to allow other processes to have cpu time
- }
- // For some reason this has to be here to avoid issue:
- // if you have multiple OSG windows up
- // and you exit one then all stop rendering
- //AfxMessageBox("Exit Rendering Thread");
- _endthread();
- }
复制代码 |
|