Hi Robert,
thank you for answering me but i'm confused I don't really understand what
you want me to do on my example ?
In fact the problem is that resizedImplementation function is called 1 time,
then there is a loop on _cameras vector (filled with 2 cameras in my
example, the main and the slave).
During this loop, the projection is updated for the main camera then the
offset projection is updated for the slave camera.
After resizedImplementation function is finished, there is a call to void
View::updateSlave(unsigned int i) function wich update my slave camera
projection by multiplying the main camera projection matrix (wich is already
updated) by the offset projection computed earlier. So the projection matrix
from the slave camera is different from the main camera projection matrix.
I hope I'm clear, but seems to me that it's very important to correct that.
If it's help I achieve to avoid the weird behaviour by replacing in
GraphicsContext.cpp :
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;
}
}
*by *
if (slave && camera->getReferenceFrame()==osg::Transform::RELATIVE_RF)
{
switch(view->getCamera()->getProjectionResizePolicy())
{
case(osg::Camera::HORIZONTAL):
slave->_camera->getProjectionMatrix() *=
osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break;
case(osg::Camera::VERTICAL):
slave->_camera->getProjectionMatrix() *= osg::Matrix::scale(1.0,
aspectRatioChange,1.0); break;
default: break;
}
}
2009/5/15 Robert Osfield <[email protected]>
> Hi Alexandre,
>
>
> On Fri, May 15, 2009 at 9:55 AM, Alexandre Amalric
> <[email protected]> wrote:
> > I do not understand why we only update the projectionOffset from the
> slave
> > camera and why we don't update the projection matrix itself.
>
> The slave uses a relative reference frame the camera's projection
> matrix is update on each new frame by multiplying the master's camer's
> projection matrix by the projection offset matrix of the slave. So
> there isn't any point modifying the slave's projection matrix as it'll
> be overritten anyway.
>
> In your example I wonder if the problem is down to your have two
> camera's, and master camera that is assigned to the graphics window so
> gets resized, and a slave camera that gets assigned to the also gets
> it's offset resized, putting these two resizes together you'll end up
> with a double resize.
>
> Could you changing you example so that the you have the viewer's
> master camera (not assigned to the graphics context) , then two slave
> cameras to see if it works fine.
>
> In terms of catching this particular usage model in the resize code...
> it's a bit awkward, if the master camera to a slave has been resized
> and the slave has a relative reference frame then it shouldn't be
> resized. This only works if the master camera shares the same
> graphics context, if it doesn't then you'll be a bit stuck as you'd
> have to apply the inverse of the master's projection matrix's resizing
> to the slaves.
>
> Perhaps this could be done by the resize code detecting a master/slave
> set up where double resizes are present, and then have inverse of the
> resizes to the master pass down to the slave.
>
> Robert.
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
--
Alexandre AMALRIC Ingénieur R&D
===================================
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org