The Matrox was probably not running the shader, and fixed-function will work.
The fix you are looking for is in my earlier reply on this thread Cheers Mihai Chris Denham wrote: > Hmm... think this might me a video card/driver specific problem. > I just tried this test on my colleague's PC that has a matrox video > card and seemed to work ok. > Oh rats.... does that mean it not so easy/impossible to fix the problem? :-( > Chris. > > > >> Date: Thu, 1 Nov 2007 17:56:06 +0000 >> From: "Chris Denham" <[EMAIL PROTECTED]> >> Subject: [osg-users] Scene renders black when replacing a >> ShadowedScene >> To: osg-users@lists.openscenegraph.org >> >> I'm getting a problem when assigning a new shadowed scene to the viewer. >> What seems to happen is that once the first scene has been rendered, >> the assignment of a new shadowed scene results in a everything in the >> scene being drawn black. Also odd is the fact that there doesn't seem >> to be a problem when a texture is assigned to objects being drawn. >> >> I have created a minimal example that exhibits the problem, and pasted >> it below. >> Any ideas what's going wrong? Can anyone reproduce the effect? >> >> [I'm using osg2.2 on windowsXP with Radeon X300 with latest drivers.] >> >> ---------------------------------------------------------------------------------------------------- >> #include <osg/ShapeDrawable> >> #include <osg/Geode> >> #include <osgGA/TrackballManipulator> >> #include <osgShadow/ShadowedScene> >> #include <osgShadow/ShadowMap> >> #include <osgDB/ReadFile> >> #include <osgViewer/Viewer> >> >> const int ReceivesShadowTraversalMask = 0x1; >> const int CastsShadowTraversalMask = 0x2; >> >> osg::Node* createShadowedScene(bool withTexture) >> { >> osgShadow::ShadowedScene* shadowedScene = new osgShadow::ShadowedScene; >> >> shadowedScene->setReceivesShadowTraversalMask(ReceivesShadowTraversalMask); >> shadowedScene->setCastsShadowTraversalMask(CastsShadowTraversalMask); >> shadowedScene->setShadowTechnique(new osgShadow::ShadowMap()); >> >> osg::LightSource* lightSource = new osg::LightSource; >> lightSource->getLight()->setPosition(osg::Vec4(0, 0.2, 1, 0)); >> >> osg::ShapeDrawable * shape = new osg::ShapeDrawable(new >> osg::Sphere(osg::Vec3(0.0f, 0.0f, 0.0f), 200.0)); >> shape->setColor(osg::Vec4(0.8f, 0.8f, 0.8f, 1.0f)); >> osg::Geode* geode = new osg::Geode(); >> geode->addDrawable(shape); >> >> if (withTexture) >> { >> geode->getOrCreateStateSet()->setTextureAttributeAndModes( 0, >> new osg::Texture2D(osgDB::readImageFile("Images/lz.rgb")), >> osg::StateAttribute::ON); >> } >> >> shadowedScene->addChild(geode); >> shadowedScene->addChild(lightSource); >> >> return shadowedScene; >> } >> >> int main(int argc, char** argv) >> { >> bool withTexture = false; >> >> osgViewer::Viewer viewer; >> viewer.setThreadingModel(osgViewer::Viewer::SingleThreaded); >> viewer.setCameraManipulator(new osgGA::TrackballManipulator()); >> viewer.realize(); >> >> viewer.setSceneData(createShadowedScene(withTexture)); >> #if 1 >> // Drawing the frame then assigning a new shadowed scene >> // seems to result in scene being rendered black. >> // Although, seems ok when texture is assigned to the object. >> viewer.frame(); >> viewer.setSceneData(createShadowedScene(withTexture)); >> #endif >> >> viewer.run(); >> >> return 0; >> } >> >> #endif >> >> > _______________________________________________ > 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