diff --git a/include/osg/Camera b/include/osg/Camera index 54849e260..a42766607 100644 --- a/include/osg/Camera +++ b/include/osg/Camera @@ -80,7 +80,8 @@ class SG_EXPORT Camera: public osg::Referenced enum AdjustAspectRatioMode { ADJUST_VERTICAL, - ADJUST_HORIZONTAL + ADJUST_HORIZONTAL, + ADJUST_NONE }; /** Set the way that the vertical or horizontal dimensions of the window diff --git a/src/osg/Camera.cpp b/src/osg/Camera.cpp index 5203f01fb..44e02fbcc 100644 --- a/src/osg/Camera.cpp +++ b/src/osg/Camera.cpp @@ -163,7 +163,6 @@ void Camera::setFrustum(const double left, const double right, _top = top/zNear; _zNear = zNear; _zFar = zFar; - _dirty = true; } @@ -240,17 +239,20 @@ void Camera::adjustAspectRatio(const double newAspectRatio, const AdjustAspectRa return; } - double previousAspectRatio = (_right-_left)/(_top-_bottom); - double deltaRatio = newAspectRatio/previousAspectRatio; - if (aa == ADJUST_HORIZONTAL) + if(aa != ADJUST_NONE) // If adjustment todo { - _left *= deltaRatio; - _right *= deltaRatio; - } - else // aa == ADJUST_VERTICAL - { - _bottom /= deltaRatio; - _top /= deltaRatio; + double previousAspectRatio = (_right-_left)/(_top-_bottom); + double deltaRatio = newAspectRatio/previousAspectRatio; + if (aa == ADJUST_HORIZONTAL) + { + _left *= deltaRatio; + _right *= deltaRatio; + } + else // aa == ADJUST_VERTICAL + { + _bottom /= deltaRatio; + _top /= deltaRatio; + } } _dirty = true;