Hi Gianluca,

The OSG by default recomputes the near and far distances during the
cull traversal to optimize the precision of depth buffer/avoid
clipping out of far objects/near objects.   While this is a useful
facility most of the time, if you are relying upon specifc values of
near/far that you have set up in your app then you can see problems.
The way to disable this recompute of the near/far is to do in your
osgProducer based app:

   // get the SceneView from the SceneHandler then...
   sceneView->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

Or if you upgrade to a OSG-2.x series of the OSG and use osgViewer you'd do:

   
viewer.getCamera()->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);

Robert.

On Wed, Oct 22, 2008 at 9:02 AM, Gianluca Natale
<[EMAIL PROTECTED]> wrote:
> Hi All.
>
> I have to debug an application based upon OSG (actually I'm still a novice
> of OSG).
>
> I found this strange behavior, in this fragment of code:
>
>
>
> Let's define:
>
> ---------------------------------------------------------------------------------------
>
> osgProducer::OsgSceneHandler * sh = new osgProducer::OsgSceneHandler;
>
> osg::ref_ptr<osgUtil::SceneView> sceneView = sh->getSceneView();
> Producer::ref_ptr<Producer::Camera> camera;
>
> camera->setSceneHandler(sh);
>
> ----------------------------------------------------------------------------------------
>
> ….
>
>
>
> Then:
>
> ---------------------------------------------------------------------------------------
>
> double fovy, aspectRatio, zNear, zFar;
>
> sceneView->getProjectionMatrixAsPerspective(fovy,aspectRatio,zNear,zFar);
>
> camera->frame(true);
>
> sceneView->getProjectionMatrixAsPerspective(fovy,aspectRatio,zNear,zFar);
>
> ----------------------------------------------------------------------------------------------------------
>
>
>
> Well,
> I get different zNear, zFar before and after the call to camera->frame.
>
> How is it possible?
>
> Is there a setting in SceneView that allows to update the projection matrix
> during draw traversal, using the bounding sphere of the whole model?
>
>
>
> Thank you.
>
> Gianluca Natale
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to