From Himar Carmona, " this submission resolves an issue regarding the setup of a slave camera with an (incorrect) coding style. Sharing the same instance of osg::Viewport with a camera and a slave camera causes incorrect rescaling in GraphicsContext::resizedImplementation, due to the viewport being rescaled twice (once per camera). Though viewports sharing is not intentional, it can be done with the current version of OSG and be a potential pitfall for anyone.
From Himar Carmona, " this submission resolves an issue regarding the setup of a slave camera with an (incorrect) coding style. Sharing the same instance of osg::Viewport with a camera and a slave camera causes incorrect rescaling in GraphicsContext::resizedImplementation, due to the viewport being rescaled twice (once per camera). Though viewports sharing is not intentional, it can be done with the current version of OSG and be a potential pitfall for anyone.

   As Robert pointed out, i opted for modifying the resize code where the break is to minimize code changes, avoiding the duplicate resize of the viewport with the use of a vector and a search for duplicates. Not very elegant (avoiding an effect of a cause), another approach could be ripping out the method osg::Camera::setViewport(osg::Viewport*) which is more inline with Roberts rationale behind not to share viewports between cameras and left only its overloaded method setViewport(x,y,width,height). But this approach need some refactoring due to the intense use of the method. Notice also that the resize works well without this change if no sharing occurs, and the user of the method can opt for always call setViewport with a new instance.
 "

Note from Robert Osfield, changed this submission to use an std::set<Viewport*> rather than an std::vector<> as it keeps the code a bit cleaner and more compact.


openscenegraph/osg,jtorresfabra/osg,jtorresfabra/osg,tomasthoresen/osg,openscenegraph/osg,artoolkit/osg,jtorresfabra/osg,marchelbling/osg,marchelbling/osg,scrawl/osg,openscenegraph/osg,tomasthoresen/osg,marchelbling/osg,jtorresfabra/osg,scrawl/osg,tomasthoresen/osg,marchelbling/osg,openscenegraph/osg,artoolkit/osg,artoolkit/osg,artoolkit/osg,tomasthoresen/osg,scrawl/osg,scrawl/osg