|
楼主 |
发表于 2014-4-14 10:50:25
|
显示全部楼层
本帖最后由 abc-osg 于 2014-4-14 11:16 编辑
cOSG::cOSG(HWND hWnd) :
m_hWnd(hWnd)
{...}
cOSG::~cOSG()
{
mViewer->stopThreading();
mViewer->setDone(true);
//Sleep(1);
delete mViewer;
}
void cOSG::Render(void* ptr)
{
cOSG* osg = (cOSG*)ptr;
osgViewer::Viewer* viewer = osg->getViewer();
while(!viewer->done())
{
osg->PreFrameUpdate();
viewer->frame();
//viewer->
osg->PostFrameUpdate();
//Sleep(10); // Use this command if you need to allow other processes to have cpu time
}
_endthread();
}
oid cOSG::InitOSG()//std::string modelname)
{
InitCameraConfig();
}
void cOSG::InitCameraConfig(void)
{
没有做任何修改 拷贝例子的代码
}
控件里面:
int CMyCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: 在此添加您专用的创建代码
mOSG = new cOSG(m_hWnd);
mOSG->InitOSG();
mThreadHandle = (HANDLE)_beginthread(&cOSG::Render, 0, mOSG);
return 0;
}
void CMyCtrl::OnDestroy()
{
if(mOSG != NULL) delete mOSG;
WaitForSingleObject(mThreadHandle, 10);
COleControl::OnDestroy();
// TODO: 在此处添加消息处理程序代码
}
cenfer 你qq多少?我们私聊。 |
|