在我的OpenSceneGraph程序中,我有以下代码:
osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface();
if (!wsi) {
osg::notify(osg::NOTICE) << "Error, no WindowingSystemInterface available, cannot create windows." << std::endl;
return 0;
}不幸的是,getWindowingSystemInterface()方法返回一个空值,因此程序无法继续运行。它返回null的原因是什么?我如何更改我的程序(或构建设置?)让它返回一个非空值?我使用的是Visual Studio 2012。
发布于 2014-09-18 02:16:46
您可能会在创建接口之前查询它,因此它返回一个null。
请参阅"set“方法(从3.1.3 dev build开始),如果你的通知级别是INFO或更高,它会执行打印:
void GraphicsContext::setWindowingSystemInterface(WindowingSystemInterface* callback)
{
ref_ptr<GraphicsContext::WindowingSystemInterface> &wsref = windowingSystemInterfaceRef();
wsref = callback;
OSG_INFO<<"GraphicsContext::setWindowingSystemInterface() "<<wsref.get()<<"\t"<<&wsref<<std::endl;
}http://www.openscenegraph.com/index.php/documentation/debugging-tips
https://stackoverflow.com/questions/25843405
复制相似问题