HI Alexandre, I've now had a chance to have a look at the reproducing the problems using your modified example and data. The problem was due to a double scaling of the projection matrices due to the unusual combination of having an active master and slave combination, and while the usage case in not really what osgViewer was designed for it's still a bug.
The solution to this bug was applying the inverse of the master's rescaling to the slave's projection offset. I applied this solution and tested against your modified osgwindows example and it now behaves fine, with the two cameras staying in sync. This fix is now checked into svn/trunk. Robert. On Fri, May 15, 2009 at 9:55 AM, Alexandre Amalric <alex.pix...@gmail.com> wrote: > Hi osg-users, > > I apparently found something strange when adding slave camera to osg viewer > and resizing window. > > I'm using osg SVN version > > I made a quick sample code to show community the weird behaviour. > > Quick explanation : My goal is to render an object made from 2 cubes (same > size), one is opaque and the other one is transparent. The first main camera > render only the opaque part, and the second camera (a slave one) render the > transparent part. When resizing the window the projection matrix isn't well > computed for the slave camera. > > So the transparent cube isn't the same aspect as the opaque cube. > > I think I found the bug in GraphicsContext.cpp file at : > > if (slave && camera->getReferenceFrame()==osg::Transform::RELATIVE_RF) > { > switch(view->getCamera()->getProjectionResizePolicy()) > { > case(osg::Camera::HORIZONTAL): slave->_projectionOffset > *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; > case(osg::Camera::VERTICAL): slave->_projectionOffset *= > osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; > default: break; > } > } > > I do not understand why we only update the projectionOffset from the slave > camera and why we don't update the projection matrix itself. > > Hope you'll understand my problem ;-) > > -- > Alexandre AMALRIC Ingénieur R&D > =================================== > PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille > http://www.pixxim.fr > > _______________________________________________ > 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