OSG默认的窗口时全屏的,调试的时候不方便。
viewer.setUpViewInWindow(100, 100, 800, 600);
----------------------------------------------------------------------------------------
在网上看到一段代码,也可以非全屏显示
int _tmain(int argc, _TCHAR* argv[])
{
osgViewer::Viewer viewer;
osg::Node *pNode = osgDB::readNodeFile("glider.osg");
if (pNode) {
viewer.setSceneData(pNode);
viewer.realize();// 必须调用Realize,否则窗口没有创建
osgViewer::GraphicsWindow *pWnd = dynamic_cast<osgViewer::GraphicsWindow*>(viewer.getCamera()->getGraphicsContext());
if (pWnd) {
pWnd->setWindowRectangle(20, 20, 800, 600);
pWnd->setWindowDecoration(true);
}
viewer.run();
}
return 0;
}