> Which version of the OSG are your using?

Still on 1.1 while I learn my way.

> Its simply the cull traversal is finding an empty scene so unable to
set the near and far sensibly.

I figured as much from looking at the osg::source code. I was hoping to
disable this feature (to make it more Performer like, I confess :-)).

> Errrh the setComputeNearFarMode you used above switches off the auto
compute... :)

Good. That is what I was hoping it would do.

> To set the near and far you simple use the
SceneView::setProjectionMatrix*() methods.

OK. I am calling this method already but the near/far values are NOT
being set in the CullVisitor when I have switched off the auto near/far
compute.

After some additional experimentation I have found that the following
code fixes the problem, if it is called after the setProjectionMatrix*()
call.

osgUtil::CullVisitor *cv = m_SceneView -> getCullVisitor() ;
osgUtil::CullVisitor::value_type znear = -1.0 ;
osgUtil::CullVisitor::value_type zfar  = 1.0 ;
cv -> clampProjectionMatrix( m_SceneView -> getProjectionMatrix(),
znear, zfar ) ;

It looks to me as if clampProjectionMatrix() needs to be called if the
auto compute is turned off in order for the clip planes to be set
correctly. Do you agree?

Regards,
Andy.

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert
Osfield
Sent: 17 November 2006 09:26
To: osg users
Subject: Re: [osg-users] Setting SceneView Near and Far clip planes

Hi Andy,

Which version of the OSG are your using?

On 11/17/06, Andy Preece <[EMAIL PROTECTED]> wrote:
> In my MFC application I create an osgUtilSceneView (shown below) and
attach
> a simple scene graph with a Switch node as the root. Initially all the
> children of the Switch node are set off. When I execute the program, I
get
> the following message displayed every frame until I enable the Switch.
The
> scene displays correctly.
>
> _clampProjectionMatrix not applied, invalid depth range, znear =
> 3.40282e+038 zfar = -3.40282e+038
>
>
>
> If I add the line 'm_SceneView -> setComputeNearFarMode(
> osgUtil::CullVisitor::DO_NOT_COMPUTE_NEAR_FAR ) ;' the
> error message dissappears but some parts of the scene are missing
(e.g.
> Those bits of the scene that lie outside the clip range 0.0 to -1.0).
>
> Can anyone explain this behaviour?

Its simply the cull traversal is finding an empty scene so unable to
set the near and far sensibly.  Later versions of the OSG handle this
case better.

> How so I set the osgUtil::SceneView's near and far clip plane values
and
> prevent them from being auto-calculated for me?

Errrh the setComputeNearFarMode you used above switches off the auto
compute... :)

To set the near and far you simple use the
SceneView::setProjectionMatrix*() methods.

Robert.
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.The service is powered by 
MessageLabs. 
________________________________________________________________________
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to