|
I'm confused about the code that does the resize in GraphicsContext.cpp
(part is pasted below). In my case, my background camera is a slave camera with an absolute reference frame. So, it isn't going to be caught in the if statement on line 7 and will fall through to the else. In this block, it is going to test the resize policy of the main camera rather than my slave (line 18). In my app, the main camera has a HORIZONTAL resize policy. Is it incorrect to have a slave with an absolute frame that differs from the main camera's? 1: // if aspect ratio adjusted change the project matrix to suit. 2: if (aspectRatioChange != 1.0) 3: { 4: osg::View* view = camera->getView(); 5: osg::View::Slave* slave = view ? view->findSlaveForCamera(camera) : 0; 6: 7: if (slave && camera->getReferenceFrame()==osg::Transform::RELATIVE_RF) 8: { 9: switch(view->getCamera()->getProjectionResizePolicy()) 10: { 11: case(osg::Camera::HORIZONTAL): slave->_projectionOffset *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; 12: case(osg::Camera::VERTICAL): slave->_projectionOffset *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; 13: default: break; 14: } 15: } 16: else 17: { 18: Camera::ProjectionResizePolicy policy = view ? view->getCamera()->getProjectionResizePolicy() : camera->getProjectionResizePolicy(); 19: switch(policy) 20: { 21: case(osg::Camera::HORIZONTAL): camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; 22: case(osg::Camera::VERTICAL): camera->getProjectionMatrix() *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; 23: default: break; 24: } 25: } 26: } Cory Robert Osfield wrote: On Mon, May 4, 2009 at 3:08 PM, Cory Riddell <[email protected]> wrote:Thanks Robert and Paul. I just assumed that a direct GDI call would be faster, but when I think about it, that can't be true (assuming a decent OpenGL driver). |
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

