Hi again,
Sorry I was in hurry and I made many errors in my last post it was almost
unreadable. I repeat it with at least few of them fixed ;-)
You won't find osgShadow::ShadowMap::init it on a Stack Trace. You have to
place breakpoint into it. You do this to make sure its actually NOT CALLED
before osgShadow::ShadowMap::cull gets called. If init is not called it
means that unitialized variables are the reason of your problem.
If crash happens, its probably in some function on Stack called as result
of from ShadowMap::cull. I bet getDataVariance is called with stateset being
NULL ? Right ?
Did you call osgShadow::ShadowMap::init after or before attaching it to
ShadowedScene (_shadowedScene->setShadowTechnique( sm )) ? It should be done
after. If done before init will not work.
Below is excerpt from my code. In this example I replace 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();
}
If this does not help, I give up ;-(
Cheers,
Wojtek
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org