diff --git a/examples/osgkeystone/osgkeystone.cpp b/examples/osgkeystone/osgkeystone.cpp index 707b1bd89..a0d511030 100644 --- a/examples/osgkeystone/osgkeystone.cpp +++ b/examples/osgkeystone/osgkeystone.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include @@ -74,7 +75,8 @@ int main( int argc, char **argv ) { OSG_NOTICE<<" keystone filename = "<<*itr<setKeystoneHint(true); if (!ds->getKeystoneFileNames().empty()) { @@ -88,30 +90,14 @@ int main( int argc, char **argv ) std::string filename; keystone->getUserValue("filename",filename); OSG_NOTICE<<"Loaded keystone "<getKeystones().push_back(keystone); } } } - osgViewer::Keystone::loadKeystoneFiles(ds); + viewer.apply(new osgViewer::SingleScreen(0)); - if (!ds->getKeystoneHint()) - { - OSG_NOTICE<<"Keystone disabled"<getStereo()) - { - viewer.setUpViewForStereo(); - } - else - { - osg::ref_ptr keystone = 0; - if (!(ds->getKeystones().empty())) keystone = dynamic_cast(ds->getKeystones().front().get()); - if (!keystone) keystone = new osgViewer::Keystone; - - viewer.setUpViewForKeystone(keystone.get()); - } - viewer.realize(); while(!viewer.done()) diff --git a/include/osgViewer/View b/include/osgViewer/View index 1ab324b9c..b9de2ee52 100644 --- a/include/osgViewer/View +++ b/include/osgViewer/View @@ -289,8 +289,7 @@ class OSGVIEWER_EXPORT View : public osg::View, public osgGA::GUIActionAdapter osg::Camera* assignRenderToTextureCamera(osg::GraphicsContext* gc, int width, int height, osg::Texture* texture); osg::Camera* assignKeystoneDistortionCamera(osg::DisplaySettings* ds, osg::GraphicsContext* gc, int x, int y, int width, int height, GLenum buffer, osg::Texture* texture, Keystone* keystone); osg::Camera* assignStereoCamera(osg::DisplaySettings* ds, osg::GraphicsContext* gc, int x, int y, int width, int height, GLenum buffer, double eyeScale); - void setUpViewForStereo(); - void setUpViewForKeystone(Keystone* keystone); + void assignStereoOrKeystoneToCamera(osg::Camera* camera, osg::DisplaySettings* ds); struct StereoSlaveCallback : public osg::View::Slave::UpdateSlaveCallback { diff --git a/include/osgViewer/config/SingleWindow b/include/osgViewer/config/SingleWindow index 9b88b0c33..ff8796c7c 100644 --- a/include/osgViewer/config/SingleWindow +++ b/include/osgViewer/config/SingleWindow @@ -23,9 +23,9 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig { public: - SingleWindow():_x(0),_y(0),_width(-1),_height(-1),_screenNum(0),_border(true),_overrideRedirect(false) {} - SingleWindow(int x, int y, int width, int height, unsigned int screenNum=0):_x(x),_y(y),_width(width),_height(height),_screenNum(screenNum),_border(true),_overrideRedirect(false) {} - SingleWindow(const SingleWindow& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):ViewConfig(rhs,copyop), _x(rhs._x),_y(rhs._y),_width(rhs._width),_height(rhs._height),_screenNum(rhs._screenNum),_border(rhs._border), _overrideRedirect(rhs._overrideRedirect) {} + SingleWindow():_x(0),_y(0),_width(-1),_height(-1),_screenNum(0),_windowDecoration(true),_overrideRedirect(false) {} + SingleWindow(int x, int y, int width, int height, unsigned int screenNum=0):_x(x),_y(y),_width(width),_height(height),_screenNum(screenNum),_windowDecoration(true),_overrideRedirect(false) {} + SingleWindow(const SingleWindow& rhs, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):ViewConfig(rhs,copyop), _x(rhs._x),_y(rhs._y),_width(rhs._width),_height(rhs._height),_screenNum(rhs._screenNum),_windowDecoration(rhs._windowDecoration), _overrideRedirect(rhs._overrideRedirect) {} META_Object(osgViewer,SingleWindow); @@ -46,8 +46,8 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig void setScreenNum(unsigned int sn) { _screenNum = sn; } unsigned int getScreenNum() const { return _screenNum; } - void setBorder(bool border) { _border = border; } - bool getBorder() const { return _border; } + void setWindowDecoration(bool wd) { _windowDecoration = wd; } + bool getWindowDecoration() const { return _windowDecoration; } void setOverrideRedirect(bool override) { _overrideRedirect = override; } bool getOverrideRedirect() const { return _overrideRedirect; } @@ -56,7 +56,7 @@ class OSGVIEWER_EXPORT SingleWindow : public ViewConfig int _x, _y, _width, _height; unsigned int _screenNum; - bool _border; + bool _windowDecoration; bool _overrideRedirect; }; diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index 31e8918c1..8de1ae2f8 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -1385,11 +1385,11 @@ static const GLubyte patternCheckerboard[] = { 0xAA, 0xAA, 0xAA, 0xAA}; -void View::setUpViewForStereo() +void View::assignStereoOrKeystoneToCamera(osg::Camera* camera, osg::DisplaySettings* ds) { - osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get(); - if (!ds->getStereo()) return; - + if (!camera || camera->getGraphicsContext()==0) return; + if (!ds->getStereo() && !ds->getKeystoneHint()) return; + ds->setUseSceneViewForStereoHint(false); typedef std::vector< osg::ref_ptr > Keystones; @@ -1418,60 +1418,47 @@ void View::setUpViewForStereo() double distance = osg::DisplaySettings::instance()->getScreenDistance(); double vfov = osg::RadiansToDegrees(atan2(height/2.0f,distance)*2.0); - getCamera()->setProjectionMatrixAsPerspective( vfov, width/height, 1.0f,10000.0f); + camera->setProjectionMatrixAsPerspective( vfov, width/height, 1.0f,10000.0f); } - int screenNum = 0; - - osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (!wsi) - { - OSG_NOTICE<<"Error, no WindowSystemInterface available, cannot create windows."<getNumScreens(si); + osg::ref_ptr gc = camera->getGraphicsContext(); - osg::GraphicsContext::ScreenIdentifier si; - si.readDISPLAY(); + osg::ref_ptr traits = const_cast(camera->getGraphicsContext()->getTraits()); - // displayNum has not been set so reset it to 0. - if (si.displayNum<0) si.displayNum = 0; - - si.screenNum = screenNum; - - unsigned int width, height; - wsi->getScreenResolution(si, width, height); - -// width/=2; height/=2; - - osg::ref_ptr traits = new osg::GraphicsContext::Traits(ds); - traits->hostName = si.hostName; - traits->displayNum = si.displayNum; - traits->screenNum = si.screenNum; - traits->x = 0; - traits->y = 0; - traits->width = width; - traits->height = height; - traits->windowDecoration = false; - traits->doubleBuffer = true; - traits->sharedContext = 0; - - OSG_NOTICE<<"traits->stencil="<stencil< gc = osg::GraphicsContext::createGraphicsContext(traits.get()); - if (!gc) + if (!ds->getStereo()) { - OSG_NOTICE<<"GraphicsWindow has not been created successfully."< keystone = 0; + if (!(ds->getKeystones().empty())) keystone = dynamic_cast(ds->getKeystones().front().get()); + if (!keystone) keystone = new osgViewer::Keystone; + + // create distortion texture + osg::ref_ptr texture = createDistortionTexture(traits->width, traits->height); + + // create RTT Camera + assignRenderToTextureCamera(gc.get(), traits->width, traits->height, texture.get()); + + // create Keystone distortion camera + osg::ref_ptr distortion_camera = assignKeystoneDistortionCamera(ds, gc.get(), + 0, 0, traits->width, traits->height, + traits->doubleBuffer ? GL_BACK : GL_FRONT, + texture.get(), keystone.get()); + // attach Keystone editing event handler. + distortion_camera->addEventCallback(new KeystoneHandler(keystone.get())); + + camera->setGraphicsContext(0); + return; } - + switch(ds->getStereoMode()) { case(osg::DisplaySettings::QUAD_BUFFER): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + // left Camera left buffer osg::ref_ptr left_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK_LEFT : GL_FRONT_LEFT, -1.0); left_camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); @@ -1556,6 +1543,9 @@ void View::setUpViewForStereo() } case(osg::DisplaySettings::ANAGLYPHIC): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + // left Camera red osg::ref_ptr left_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, -1.0); left_camera->setClearMask(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); @@ -1635,9 +1625,9 @@ void View::setUpViewForStereo() right_keystone_camera->getOrCreateStateSet()->setAttribute(new osg::ColorMask(false, true, true, true)); // attach Keystone editing event handler. - right_keystone_camera->addEventCallback(new KeystoneHandler(keystone.get())); + left_keystone_camera->addEventCallback(new KeystoneHandler(keystone.get())); - getCamera()->setAllowEventFocus(false); + camera->setAllowEventFocus(false); } else @@ -1668,15 +1658,17 @@ void View::setUpViewForStereo() // create Keystone distortion camera - osg::ref_ptr camera = assignKeystoneDistortionCamera(ds, gc.get(), + osg::ref_ptr distortion_camera = assignKeystoneDistortionCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, texture.get(), keystone.get()); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); + distortion_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); // attach Keystone editing event handler. - camera->addEventCallback(new KeystoneHandler(keystone.get())); + distortion_camera->addEventCallback(new KeystoneHandler(keystone.get())); + + camera->setAllowEventFocus(false); } } @@ -1684,6 +1676,9 @@ void View::setUpViewForStereo() } case(osg::DisplaySettings::HORIZONTAL_SPLIT): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + bool left_eye_left_viewport = ds->getSplitStereoHorizontalEyeMapping()==osg::DisplaySettings::LEFT_EYE_LEFT_VIEWPORT; int left_start = (left_eye_left_viewport) ? 0 : traits->width/2; int right_start = (left_eye_left_viewport) ? traits->width/2 : 0; @@ -1765,7 +1760,7 @@ void View::setUpViewForStereo() // attach Keystone editing event handler. right_keystone_camera->addEventCallback(new KeystoneHandler(right_keystone.get())); - getCamera()->setAllowEventFocus(false); + camera->setAllowEventFocus(false); } @@ -1773,6 +1768,9 @@ void View::setUpViewForStereo() } case(osg::DisplaySettings::VERTICAL_SPLIT): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + bool left_eye_bottom_viewport = ds->getSplitStereoVerticalEyeMapping()==osg::DisplaySettings::LEFT_EYE_BOTTOM_VIEWPORT; int left_start = (left_eye_bottom_viewport) ? 0 : traits->height/2; int right_start = (left_eye_bottom_viewport) ? traits->height/2 : 0; @@ -1861,7 +1859,7 @@ void View::setUpViewForStereo() // attach Keystone editing event handler. right_keystone_camera->addEventCallback(new KeystoneHandler(right_keystone.get())); - getCamera()->setAllowEventFocus(false); + camera->setAllowEventFocus(false); } @@ -1869,6 +1867,9 @@ void View::setUpViewForStereo() } case(osg::DisplaySettings::LEFT_EYE): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + // single window, whole window, just left eye offsets osg::ref_ptr left_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, -1.0); @@ -1903,20 +1904,23 @@ void View::setUpViewForStereo() // create Keystone distortion camera - osg::ref_ptr camera = assignKeystoneDistortionCamera(ds, gc.get(), + osg::ref_ptr distortion_camera = assignKeystoneDistortionCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, texture.get(), keystone.get()); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); + distortion_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); // attach Keystone editing event handler. - camera->addEventCallback(new KeystoneHandler(keystone.get())); + distortion_camera->addEventCallback(new KeystoneHandler(keystone.get())); } break; } case(osg::DisplaySettings::RIGHT_EYE): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + // single window, whole window, just right eye offsets osg::ref_ptr right_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, 1.0); @@ -1950,15 +1954,15 @@ void View::setUpViewForStereo() right_camera->attach(osg::Camera::COLOR_BUFFER, texture.get()); // create Keystone distortion camera - osg::ref_ptr camera = assignKeystoneDistortionCamera(ds, gc.get(), - 0, 0, traits->width, traits->height, - traits->doubleBuffer ? GL_BACK : GL_FRONT, - texture.get(), keystone.get()); + osg::ref_ptr distortion_camera = assignKeystoneDistortionCamera(ds, gc.get(), + 0, 0, traits->width, traits->height, + traits->doubleBuffer ? GL_BACK : GL_FRONT, + texture.get(), keystone.get()); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); + distortion_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); // attach Keystone editing event handler. - camera->addEventCallback(new KeystoneHandler(keystone.get())); + distortion_camera->addEventCallback(new KeystoneHandler(keystone.get())); } break; } @@ -1966,6 +1970,9 @@ void View::setUpViewForStereo() case(osg::DisplaySettings::VERTICAL_INTERLACE): case(osg::DisplaySettings::CHECKERBOARD): { + // disconect the camera from the graphics context. + camera->setGraphicsContext(0); + // set up the stencil buffer { osg::ref_ptr camera = new osg::Camera; @@ -2016,93 +2023,29 @@ void View::setUpViewForStereo() // left Camera { - osg::ref_ptr camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, -1.0); - camera->setClearMask(0); - camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); + osg::ref_ptr left_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, -1.0); + left_camera->setClearMask(0); + left_camera->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); + left_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); osg::ref_ptr stencil = new osg::Stencil; stencil->setFunction(osg::Stencil::EQUAL, 0, ~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); - camera->getOrCreateStateSet()->setAttributeAndModes(stencil.get(), osg::StateAttribute::ON); + left_camera->getOrCreateStateSet()->setAttributeAndModes(stencil.get(), osg::StateAttribute::ON); } // right Camera { - osg::ref_ptr camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, 1.0); - camera->setClearMask(GL_DEPTH_BUFFER_BIT); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); + osg::ref_ptr right_camera = assignStereoCamera(ds, gc.get(), 0, 0, traits->width, traits->height, traits->doubleBuffer ? GL_BACK : GL_FRONT, 1.0); + right_camera->setClearMask(GL_DEPTH_BUFFER_BIT); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); osg::ref_ptr stencil = new osg::Stencil; stencil->setFunction(osg::Stencil::NOTEQUAL, 0, ~0u); stencil->setOperation(osg::Stencil::KEEP, osg::Stencil::KEEP, osg::Stencil::KEEP); - camera->getOrCreateStateSet()->setAttributeAndModes(stencil.get(), osg::StateAttribute::ON); + right_camera->getOrCreateStateSet()->setAttributeAndModes(stencil.get(), osg::StateAttribute::ON); } break; } } } - - -void View::setUpViewForKeystone(Keystone* keystone) -{ - int screenNum = 0; - - osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (!wsi) - { - OSG_NOTICE<<"Error, no WindowSystemInterface available, cannot create windows."<getScreenResolution(si, width, height); - -// width/=2; height/=2; - - osg::ref_ptr traits = new osg::GraphicsContext::Traits; - traits->hostName = si.hostName; - traits->displayNum = si.displayNum; - traits->screenNum = si.screenNum; - traits->x = 0; - traits->y = 0; - traits->width = width; - traits->height = height; - traits->windowDecoration = false; - traits->doubleBuffer = true; - traits->sharedContext = 0; - - - osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); - if (!gc) - { - OSG_NOTICE<<"GraphicsWindow has not been created successfully."< texture = createDistortionTexture(width, height); - - // create RTT Camera - assignRenderToTextureCamera(gc.get(), width, height, texture.get()); - - // create Keystone distortion camera - osg::ref_ptr camera = assignKeystoneDistortionCamera(ds, gc.get(), - 0, 0, width, height, - traits->doubleBuffer ? GL_BACK : GL_FRONT, - texture.get(), keystone); - // attach Keystone editing event handler. - camera->addEventCallback(new KeystoneHandler(keystone)); - -} - diff --git a/src/osgViewer/Viewer.cpp b/src/osgViewer/Viewer.cpp index 21fa1ba37..48aa7df7a 100644 --- a/src/osgViewer/Viewer.cpp +++ b/src/osgViewer/Viewer.cpp @@ -21,6 +21,7 @@ #include #include +#include #include #include @@ -300,6 +301,9 @@ bool Viewer::readConfiguration(const std::string& filename) { OSG_NOTICE<<"Using osgViewer::Config : "<className()<configure(*this); + + osgDB::writeObjectFile(*config,"test.osgt"); + return true; } @@ -468,29 +472,13 @@ void Viewer::realize() if (screenNum>=0) setUpViewInWindow(x, y, width, height, screenNum); else setUpViewInWindow(x,y,width,height); } + else if (screenNum>=0) + { + setUpViewOnSingleScreen(screenNum); + } else { - osg::DisplaySettings* ds = _displaySettings.valid() ? _displaySettings.get() : osg::DisplaySettings::instance().get(); - if (ds->getKeystoneHint() && !ds->getKeystoneFileNames().empty()) osgViewer::Keystone::loadKeystoneFiles(ds); - bool useKeystones = ds->getKeystoneHint() && !ds->getKeystones().empty(); - - if (ds->getStereo() && (!ds->getUseSceneViewForStereoHint() || useKeystones)) - { - setUpViewForStereo(); - } - else if (useKeystones) - { - osgViewer::Keystone* keystone = dynamic_cast(ds->getKeystones().front().get()); - setUpViewForKeystone(keystone); - } - else if (screenNum>=0) - { - setUpViewOnSingleScreen(screenNum); - } - else - { - setUpViewAcrossAllScreens(); - } + setUpViewAcrossAllScreens(); } } diff --git a/src/osgViewer/config/SingleScreen.cpp b/src/osgViewer/config/SingleScreen.cpp index 12e6b311b..83b0400c6 100644 --- a/src/osgViewer/config/SingleScreen.cpp +++ b/src/osgViewer/config/SingleScreen.cpp @@ -16,73 +16,15 @@ #include #include +#include + #include using namespace osgViewer; void SingleScreen::configure(osgViewer::View& view) const { - osg::GraphicsContext::WindowingSystemInterface* wsi = osg::GraphicsContext::getWindowingSystemInterface(); - if (!wsi) - { - OSG_NOTICE<<"SingleScreen::configure() : Error, no WindowSystemInterface available, cannot create windows."<getScreenResolution(si, width, height); - - osg::ref_ptr traits = new osg::GraphicsContext::Traits(ds); - traits->hostName = si.hostName; - traits->displayNum = si.displayNum; - traits->screenNum = si.screenNum; - traits->x = 0; - traits->y = 0; - traits->width = width; - traits->height = height; - traits->windowDecoration = false; - traits->doubleBuffer = true; - traits->sharedContext = 0; - - osg::ref_ptr gc = osg::GraphicsContext::createGraphicsContext(traits.get()); - - view.getCamera()->setGraphicsContext(gc.get()); - - osgViewer::GraphicsWindow* gw = dynamic_cast(gc.get()); - if (gw) - { - OSG_INFO<<"SingleScreen::configure() - GraphicsWindow has been created successfully."<getEventQueue()->getCurrentEventState()->setWindowRectangle(0, 0, width, height ); - } - else - { - OSG_NOTICE<<" GraphicsWindow has not been created successfully."<getProjectionMatrixAsPerspective(fovy, aspectRatio, zNear, zFar); - - double newAspectRatio = double(traits->width) / double(traits->height); - double aspectRatioChange = newAspectRatio / aspectRatio; - if (aspectRatioChange != 1.0) - { - view.getCamera()->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); - } - - view.getCamera()->setViewport(new osg::Viewport(0, 0, traits->width, traits->height)); - - GLenum buffer = traits->doubleBuffer ? GL_BACK : GL_FRONT; - - view.getCamera()->setDrawBuffer(buffer); - view.getCamera()->setReadBuffer(buffer); + osg::ref_ptr singleWindow = new SingleWindow(0,0,-1,-1,_screenNum); + singleWindow->setWindowDecoration(false); + singleWindow->configure(view); } diff --git a/src/osgViewer/config/SingleWindow.cpp b/src/osgViewer/config/SingleWindow.cpp index 0993a3ccc..32e81ee41 100644 --- a/src/osgViewer/config/SingleWindow.cpp +++ b/src/osgViewer/config/SingleWindow.cpp @@ -15,6 +15,13 @@ #include #include #include +#include + +#include +#include +#include +#include +#include #include @@ -29,8 +36,8 @@ void SingleWindow::configure(osgViewer::View& view) const return; } - osg::DisplaySettings* ds = getActiveDisplaySetting(view);; - + osg::DisplaySettings* ds = getActiveDisplaySetting(view); + osg::ref_ptr traits = new osg::GraphicsContext::Traits(ds); traits->readDISPLAY(); @@ -41,7 +48,7 @@ void SingleWindow::configure(osgViewer::View& view) const traits->y = _y; traits->width = _width; traits->height = _height; - traits->windowDecoration = _border; + traits->windowDecoration = _windowDecoration; traits->overrideRedirect = _overrideRedirect; traits->doubleBuffer = true; traits->sharedContext = 0; @@ -93,4 +100,21 @@ void SingleWindow::configure(osgViewer::View& view) const view.getCamera()->setDrawBuffer(buffer); view.getCamera()->setReadBuffer(buffer); + + OSG_NOTICE<<"Here"<getKeystoneHint()) + { + if (ds->getKeystoneHint() && !ds->getKeystoneFileNames().empty()) + { + osgViewer::Keystone::loadKeystoneFiles(ds); + } + if (ds->getKeystones().empty()) ds->getKeystones().push_back(new Keystone); + + view.assignStereoOrKeystoneToCamera(view.getCamera(), ds); + } + else if (ds->getStereo() && ds->getUseSceneViewForStereoHint()) + { + view.assignStereoOrKeystoneToCamera(view.getCamera(), ds); + } } diff --git a/src/osgWrappers/serializers/osgViewer/SingleWindow.cpp b/src/osgWrappers/serializers/osgViewer/SingleWindow.cpp index 4b6c4d233..6b277a9e2 100644 --- a/src/osgWrappers/serializers/osgViewer/SingleWindow.cpp +++ b/src/osgWrappers/serializers/osgViewer/SingleWindow.cpp @@ -14,6 +14,6 @@ REGISTER_OBJECT_WRAPPER( osgViewer_SingleWindow, ADD_INT_SERIALIZER( Width, -1); ADD_INT_SERIALIZER( Height, -1); ADD_UINT_SERIALIZER( ScreenNum, 0u); - ADD_BOOL_SERIALIZER( Border, true); - ADD_BOOL_SERIALIZER( OverrideRedirect, true); + ADD_BOOL_SERIALIZER( WindowDecoration, true); + ADD_BOOL_SERIALIZER( OverrideRedirect, false); }