From 9249a59db2ece61938a5f148e0dc35c384f992a5 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 13 May 2013 09:53:54 +0000 Subject: [PATCH] Fixed the render order to the Render To Texture cameras used in stereo keystoning. --- src/osgViewer/View.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index e7a435419..0b84ad298 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -2690,6 +2690,7 @@ void View::setUpViewForStereo() left_camera->setDrawBuffer(GL_FRONT); left_camera->setReadBuffer(GL_FRONT); left_camera->setAllowEventFocus(false); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 0); left_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2700,6 +2701,7 @@ void View::setUpViewForStereo() right_camera->setDrawBuffer(GL_FRONT); right_camera->setReadBuffer(GL_FRONT); right_camera->setAllowEventFocus(false); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); right_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2756,6 +2758,7 @@ void View::setUpViewForStereo() left_camera->setDrawBuffer(GL_FRONT); left_camera->setReadBuffer(GL_FRONT); left_camera->setAllowEventFocus(true); + left_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 0); left_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2770,6 +2773,7 @@ void View::setUpViewForStereo() right_camera->setDrawBuffer(GL_FRONT); right_camera->setReadBuffer(GL_FRONT); right_camera->setAllowEventFocus(true); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); right_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2850,6 +2854,7 @@ void View::setUpViewForStereo() left_camera->setDrawBuffer(GL_FRONT); left_camera->setReadBuffer(GL_FRONT); left_camera->setAllowEventFocus(true); + left_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 0); left_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2864,6 +2869,7 @@ void View::setUpViewForStereo() right_camera->setDrawBuffer(GL_FRONT); right_camera->setReadBuffer(GL_FRONT); right_camera->setAllowEventFocus(true); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); right_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2929,6 +2935,7 @@ void View::setUpViewForStereo() left_camera->setDrawBuffer(GL_FRONT); left_camera->setReadBuffer(GL_FRONT); left_camera->setAllowEventFocus(false); + left_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 0); left_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2976,6 +2983,7 @@ void View::setUpViewForStereo() right_camera->setDrawBuffer(GL_FRONT); right_camera->setReadBuffer(GL_FRONT); right_camera->setAllowEventFocus(false); + right_camera->setRenderOrder(osg::Camera::NESTED_RENDER, 0); right_camera->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT); // attach the texture and use it as the color buffer. @@ -2987,7 +2995,7 @@ void View::setUpViewForStereo() traits->doubleBuffer ? GL_BACK : GL_FRONT, texture, keystone.get()); - camera->setRenderOrder(osg::Camera::NESTED_RENDER, 2); + camera->setRenderOrder(osg::Camera::NESTED_RENDER, 1); // attach Keystone editing event handler. camera->addEventCallback(new KeystoneHandler(keystone.get()));