For tests, you may derive your ShadowMap from osgShadow::ShadowMap, override init and cull methods. In this way you will be able to check if init was called. Of course I have not tested it but the code should look more or less like this:
#include <cassert> class MyShadowMap: public osgShadow::ShadowMap { public : /** initialize the ShadowedScene and local cached data structures.*/ virtual void init() { assert( getShadowedScene() ); // ShadowMap::init does nothing if this not set osgShadow::ShadowMap::init(); // now check if all vital resources were created assert( osgShadow::ShadowMap::_stateset ); assert( osgShadow::ShadowMap::_camera ); assert( osgShadow::ShadowMap::_texture ); } /** run the cull traversal of the ShadowedScene and set up the rendering for this ShadowTechnique.*/ virtual void cull( osgUtil::CullVisitor& cv ) { // check if all vital resources were created by init assert( osgShadow::ShadowMap::_stateset ); assert( osgShadow::ShadowMap::_camera ); assert( osgShadow::ShadowMap::_texture ); osgShadow::ShadowMap::cull( cv ); } }; You may additionally call ShadowedScene->dirty() method. But I doubt it helps, dirty flag is set anyway on creation, its generally used for refreshing shadow params. What type of viewer uses your App ? J-S Guay recently observed some issues with initialization of Shaders in ShadowMap with CompositeViewer. Maybe this is related somehow. Cheers, Wojtek -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of DKa Sent: Wednesday, January 16, 2008 11:17 AM To: OpenSceneGraph Users Subject: Re: [osg-users] Adding shadow to an existing scenegraph > 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 ? Hi, sorry for the late feedback on your new suggestions. I pretty much do it like in your code (sm->init after attaching the shadow technique). Still you're right that the stateset being null is the problem and this is still not solved. Something must go wrong in the initialization. I am building against the library so I cannot put a breakpoint into the OSG-Code for the init function. Previously I did not set the texture size for the shadow map. But it seems this is the only difference to the stuff you do in order to initialize and set everything for the shadow. Cheers, 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 osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org