From Stephan Huber, "attached you'll find a new GraphicsWindowCarbon-header and .cpp, the

changes I made:

+ put a warning in the console if a nonexistant screen is requested
+ add getters for the aglcontext and pixelformat -- I need access to
them in my own code.
"
This commit is contained in:
Robert Osfield 2007-06-08 11:04:30 +00:00
parent b4cd96ebdd
commit 3e8be9ac7d
2 changed files with 13 additions and 2 deletions

View File

@ -121,6 +121,12 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
/// install the standard os-eventhandler
void installEventHandler();
/// get the AGL context
AGLContext getAGLContext() { return _context; }
// get the pixelformat
AGLPixelFormat getAGLPixelFormat() { return _pixelFormat; }
protected:
@ -128,7 +134,7 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
void transformMouseXY(float& x, float& y);
AGLContext& getAGLContext() { return _context; }

View File

@ -475,7 +475,12 @@ struct OSXCarbonWindowingSystemInterface : public osg::GraphicsContext::Windowin
/** @return a CGDirectDisplayID for a ScreenIdentifier */
inline CGDirectDisplayID getDisplayID(const osg::GraphicsContext::ScreenIdentifier& si) {
return _displayIds[si.screenNum];
if (si.screenNum < _displayCount)
return _displayIds[si.screenNum];
else {
osg::notify(osg::WARN) << "GraphicsWindowCarbon :: invalid screen # " << si.screenNum << ", returning main-screen instead" << std::endl;
return _displayIds[0];
}
}
/** @return count of attached screens */