天天看點

Linux下使用 OSG 提示unable to open display

osg::ref_ptr<osg::GraphicsContext::Traits> traits=new osg::GraphicsContext::Traits;
traits->x=0;
///添加一些屬性
///

//添加以下代碼 解決擷取圖像裝置上下文 unable to open display 問題
traits->windowDecoration=false;
traits->sharedContext=0;
traits->readDISPLAY();
traits->setUndefinedScreenDetailsToDefaultScreen();
           

注意:這裡不能通過ssh遠端方式來調用,必須在本機上執行;

繼續閱讀