|
osgEarth 2.1.1
|
Public Member Functions | |
| MyGraphicsContext () | |
| bool | valid () const |
| MyGraphicsContext () | |
| bool | valid () const |
Private Attributes | |
| osg::ref_ptr < osg::GraphicsContext > | _gc |
Definition at line 31 of file osgearth_ocean.cpp.
| MyGraphicsContext::MyGraphicsContext | ( | ) | [inline] |
Definition at line 33 of file osgearth_ocean.cpp.
{
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 = false;
traits->doubleBuffer = false;
traits->sharedContext = 0;
traits->pbuffer = true;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if (!_gc)
{
traits->pbuffer = false;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
}
if (_gc.valid())
{
_gc->realize();
_gc->makeCurrent();
}
}
| MyGraphicsContext::MyGraphicsContext | ( | ) | [inline] |
Definition at line 38 of file Capabilities.cpp.
{
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 = false;
traits->doubleBuffer = false;
traits->sharedContext = 0;
traits->pbuffer = false;
// Intel graphics adapters dont' support pbuffers, and some of their drivers crash when
// you try to create them. So by default we will only use the unmapped/pbuffer method
// upon special request.
if ( getenv( "OSGEARTH_USE_PBUFFER_TEST" ) )
{
traits->pbuffer = true;
OE_INFO << LC << "Activating pbuffer test for graphics capabilities" << std::endl;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
if ( !_gc.valid() )
OE_WARN << LC << "Failed to create pbuffer" << std::endl;
}
if (!_gc.valid())
{
// fall back on a mapped window
traits->pbuffer = false;
_gc = osg::GraphicsContext::createGraphicsContext(traits.get());
}
if (_gc.valid())
{
_gc->realize();
_gc->makeCurrent();
if ( traits->pbuffer == false )
{
OE_DEBUG << LC << "Realized graphics window for OpenGL operations." << std::endl;
}
else
{
OE_DEBUG << LC << "Realized pbuffer for OpenGL operations." << std::endl;
}
}
else
{
OE_WARN << LC << "Failed to create graphic window too." << std::endl;
}
}
| bool MyGraphicsContext::valid | ( | ) | const [inline] |
| bool MyGraphicsContext::valid | ( | ) | const [inline] |
Definition at line 89 of file Capabilities.cpp.
osg::ref_ptr< osg::GraphicsContext > MyGraphicsContext::_gc [private] |
Definition at line 63 of file osgearth_ocean.cpp.
1.7.3