Hi,
You would need to put breakpoint into osgShadow::ShadowMap::init. When it
crashes its probably due to not calling init. So you won't find it on Stack
trace. If crash happens you its probably some function under
ShadowMap::cull. getDataVariance is called with _stateset being NULL ?
Did you call osgShadow::ShadowMap::init after or before attching it to
ShadowedScene ? It should be done after. If done before init will not work.
Below is excerpt from my code. In this example I pScene group with
ShadowedScene. pScene is a child of pSceneRoot.
_shadowedScene = new osgShadow::ShadowedScene;
_shadowedScene->addChild( pScene );
osg::StateSet * stateset = pScene->getStateSet();
pSceneRoot->removeChild( pScene );
pSceneRoot->addChild( _shadowedScene.get() );
_shadowedScene->setReceivesShadowTraversalMask( ~0 );
_shadowedScene->setCastsShadowTraversalMask( ~0 );
osgShadow::ShadowMap * sm = new osgShadow::ShadowMap;
_shadowedScene->setShadowTechnique( sm );
if( lightSource )
sm->setLight( lightSource );
sm->setTextureSize( osg::Vec2s( RESOLUTION,RESOLUTION ) );
sm->init();
Cheers,
Wojtek
----- Original Message -----
From: "DKa" <[EMAIL PROTECTED]>
To: "OpenSceneGraph Users" <[email protected]>
Sent: Friday, January 11, 2008 5:57 PM
Subject: Re: [osg-users] Adding shadow to an existing scenegraph
>> Init should be called in UpdateTraversal but if for
>> some reason you created
>> your ShadowedScene after UpdateTraversal but before
>> CullTraversal : crash
>> may happen.
>
> Thanks a lot for these pointers. I still get the same
> error though after adding sm->init() or
> sm->computeDataVariance() or both. If you have already
> succeeded with such an approach maybe my problem lies
> elsewhere in the program.
>
> Lights are added under the scene root and associated
> with the scene root's stateset.
>
> By the way, there is no call to init() in the call
> stack of the debugger. The crash appears while culling
> tries to get the DataVariance...
>
> Anymore ideas regarding this problem? Maybe a short
> working sample code (apart from the osgshadow
> example).
>
> Thanks,
> D.
>
>
>
>
> ____________________________________________________________________________________
> Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now.
> http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
> _______________________________________________
> 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