|
我在Mac OSX下xcode中运行了一个demo,代码如下:
#include <iostream>
#include <OpenThreads/Config>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgDB/ReadFile>
#include <stdio.h>
int main(int argc, const char * argv[])
{
osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("xxx/cow.osg"); //路径测试过,是没问题的
osgViewer::Viewer viewer;
viewer.setUpViewInWindow(50,50,640,400);
viewer.addEventHandler( new osgViewer::StatsHandler );
viewer.addEventHandler( new osgViewer::WindowSizeHandler );
viewer.setSceneData( root.get() );
viewer.realize();
return viewer.run();
}
编译成功,运行后报错如下:
Warning: Could not find plugin to read objects from file “xxxx/cow.osg".
SingleWindow::configure() : Error, no WindowSystemInterface available, cannot create windows.
AcrossAllScreens::configure() : Error, no WindowSystemInterface available, cannot create windows.
Viewer::realize() - failed to set up any windows
AcrossAllScreens::configure() : Error, no WindowSystemInterface available, cannot create windows.
Viewer::realize() - failed to set up any windows
运行环境:
Mac OSX 10.9.2
Xcode5.1
OSG3.0.1 |
|