From 2826dafa80b9f28443a893b21a46bfa176708ba4 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 6 Feb 2007 20:03:13 +0000 Subject: [PATCH] From Stephan Huber, "thomas kirk schrieb: > I put this at the end of realizeImplementation; someone with better knowledge > of Carbon programming may see a more appropriate place for the call. I moved your code into the ctor of the OSXCarbonWindowingSystemInterface so it get called only once. Can you test it again, if it works on your side? I also disabled multithreaded-rendering because it slowed down the rendering on my machine by a factor of 3. Perhaps we can make it optional to test it on other machines. I had some problems implementing pbuffer-support for os x and stopped it for now until I have more time to investigate the issues. " --- src/osgViewer/GraphicsWindowCarbon.cpp | 88 ++++++++++++++++++++------ 1 file changed, 68 insertions(+), 20 deletions(-) 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."<