|
楼主 |
发表于 2024-5-8 16:28:59
|
显示全部楼层
后来,经跟踪,在这里报错了:_display为空,(上面的报错修改一下:Error: Unable to open display ":0.0")
virtual osg::GraphicsContext* createGraphicsContext(osg::GraphicsContext::Traits* traits)
{
if (traits->pbuffer)
{
#if 1
osg::ref_ptr<osgViewer:ixelBufferX11> pbuffer = new PixelBufferX11(traits);
if (pbuffer->valid()) return pbuffer.release();
else return 0;
#else
osg::ref_ptr<osgViewer::GraphicsWindowX11> window = new GraphicsWindowX11(traits);
if (window->valid()) return window.release();
else return 0;
#endif
}
else
{
osg::ref_ptr<osgViewer::GraphicsWindowX11> window = new GraphicsWindowX11(traits);
if (window->valid()) return window.release();
else return 0;
}
}
===》
oid PixelBufferX11::init()
{
if (_initialized) return;
if (!_traits)
{
_valid = false;
return;
}
if (_traits->target != 0)
{
// we don't support Pbuffer render to texture under GLX.
_valid = false;
return;
}
_display = XOpenDisplay(_traits->displayName().c_str());
unsigned int screen = _traits->screenNum;
if (!_display)
{
OSG_NOTICE<<"Error: Unable to open display \"" << XDisplayName(_traits->displayName().c_str()) << "\"."<<std::endl;
_valid = false;
return;
} |
|