首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >osg::GraphicsContext::WindowingSystemInterface返回null

osg::GraphicsContext::WindowingSystemInterface返回null
EN

Stack Overflow用户
提问于 2014-09-15 16:07:46
回答 1查看 351关注 0票数 1

在我的OpenSceneGraph程序中,我有以下代码:

代码语言:javascript
复制
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。

EN

回答 1

Stack Overflow用户

发布于 2014-09-18 02:16:46

您可能会在创建接口之前查询它,因此它返回一个null。

请参阅"set“方法(从3.1.3 dev build开始),如果你的通知级别是INFO或更高,它会执行打印:

代码语言:javascript
复制
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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25843405

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档