diff --git a/src/osgViewer/GraphicsWindowCarbon.cpp b/src/osgViewer/GraphicsWindowCarbon.cpp index eb213a01e..04b3f1afb 100644 --- a/src/osgViewer/GraphicsWindowCarbon.cpp +++ b/src/osgViewer/GraphicsWindowCarbon.cpp @@ -199,9 +199,9 @@ static AGLPixelFormat createPixelFormat(osg::GraphicsContext::Traits* traits) { std::vector attributes; - attributes.push_back(AGL_NO_RECOVERY); + if (!traits->pbuffer) attributes.push_back(AGL_NO_RECOVERY); attributes.push_back(AGL_RGBA); - attributes.push_back(AGL_COMPLIANT); + if (!traits->pbuffer) attributes.push_back(AGL_COMPLIANT); if (traits->doubleBuffer) attributes.push_back(AGL_DOUBLEBUFFER); if (traits->quadBufferStereo) attributes.push_back(AGL_STEREO); @@ -238,35 +238,71 @@ class GraphicsContextCarbon : public osg::GraphicsContext public: GraphicsContextCarbon(osg::GraphicsContext::Traits* traits): - _valid(false) + _valid(false), + _realized(false), + _context(NULL) { _traits = traits; + + _valid = true; } virtual bool valid() const { return _valid; } /** Realise the GraphicsContext implementation, * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ - virtual bool realizeImplementation() { osg::notify(osg::NOTICE)<<"GraphicsWindow::realizeImplementation() not implemented."<width, _traits->height, _traits->target, GL_RGBA, _traits->level, &(_pbuffer)); + if (!_realized) { + osg::notify(osg::WARN) << "GraphicsContext::realizeImplementation() aglCreatePBuffer failed! " << aglErrorString(aglGetError()) << std::endl; + } + return _realized; + } /** Return true if the graphics context has been realised, and is ready to use, implementation. * Pure virtual - must be implemented by concrate implementations of GraphicsContext. */ - virtual bool isRealizedImplementation() const { osg::notify(osg::NOTICE)<<"GraphicsWindow::isRealizedImplementation() not implemented."<