|
关键代码如下:
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->x = 0;
traits->y = 0;
traits->width = 1;
traits->height = 1;
traits->windowDecoration = true;
traits->doubleBuffer = true;
traits->sharedContext = 0;
traits->pbuffer = true;
osg::ref_ptr<osg::GraphicsContext> _gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!_gc)
{
osg::notify(osg::NOTICE)<<"Failed to create pbuffer, failing back to normal graphics window."<<std::endl;
traits->pbuffer = false;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
}
if (_gc.valid())
{
_gc->realize();
_gc->makeCurrent();
std::cout<<"Realized window"<<std::endl;
}
可是设备上下文总是创建的不成功
Failed to create pbuffer, failing back to normal graphics window.
请问是什么原因,
我以前用的时候是可以的啊 |
|