Hi, Martin You should either use clear only on camera that render first half, or use scissor test (osg::Scissor and GL_SCISSOR_TEST) set to region of camera viewport on each camera to not clear other camera's render result.
Cheers, Sergey. 05.08.2011, 18:51, "Martin Haffner" <str...@gmx.net>: > Hi, > > I made an application with a camera that rendered into a texture and > everything worked. > Now I want to render into the texture from 2 Cameras. I want cam1 to render > into the left side, and cam1 render into the right side into the texture. > Basically this is my code: > > Code: > > cam1 = new osg::CameraNode; > cam1->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); > cam1->setClearColor(clearColor); > cam1->setViewport(0, 0, m_rttWidth / 2 ,m_rttHeight); > cam1->setRenderOrder(osg::CameraNode::PRE_RENDER); > cam1->setRenderTargetImplementation( osg::CameraNode::FRAME_BUFFER_OBJECT ); > cam1->setProjectionMatrixAsPerspective(60.0f, static_cast<float>(m_rttWidth > /2) / m_rttHeight, 0.01f, farPlane); > osg::Camera::DO_NOT_COMPUTE_NEAR_FAR ); cam1->setComputeNearFarMode( > Camera::DO_NOT_COMPUTE_NEAR_FAR ); > cam1->attach(osg::Camera::COLOR_BUFFER, m_rttScene.get(), 0, 0, false, 4, 0); > cam1->addChild( sceneRootNode ); > m_CamerasNode->addChild( cam1.get() ); > > //Cam2 > // The code for cam2 exactly the same, except this line: > cam2->setViewport( m_rttWidth /2, 0, m_rttWidth /2 ,100 ); > > The left half of the texture is correctly rendered, but the right side of the > texture (which should be rendered by cam2) is black! > > Anyone has an idea what could be wrong? Maybe something with the clear flags? > Or culling? > > Thank you! > > Cheers, > Martin > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=41886#41886 > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org