Hi Robert,

Yes I know, i forgot to paste the code :

osg::ref_ptr<osg::Light> light1 = new osg::Light;
light1->setLightNum(1);

Sorry

Any idea ? because the red light is visible, but no attenuation modify it...
and this is the real problem.
Thanks,

Vincent.

2008/8/6 Robert Osfield <[EMAIL PROTECTED]>

> Hi Vincent,
>
> You'll need to set the light number of the light via
> light->setLightNum(num);  The first light should be 0, and your second
> one 1.
>
> Robert.
>
> On Wed, Aug 6, 2008 at 10:53 AM, Vincent Bourdier
> <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I've a scene with 2 lights :
> >
> > The first one (n°0) is the one for the whole scene, with ambiant
> component,
> > diffuse, specular, ...
> > The second one is attached on a node, and have to light only this node
> and
> > not all the scene.
> >
> > To do that, I put some attenuation on the second light to avoid it light
> the
> > reste of the scene... but it does nothing !
> >
> >     light1->setAmbient(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
> >     light1->setDiffuse(osg::Vec4(intensity, 0, 0, 1));
> >     light1->setSpecular(osg::Vec4(0.0f, 0.0f, 0.0f, 1));
> >     light1->setPosition(osg::Vec4(p1, 0));
> >     light1->setDirection(-p1);
> >     light1->setSpotCutoff(0.5f);
> >     light1->setConstantAttenuation(0.95f);
> >     light1->setLinearAttenuation(0.0000001f);
> >     light1->setQuadraticAttenuation(0.00000002f);
> >
> >     osg::LightSource* satLightSource1 = new osg::LightSource;
> >     satLightSource1->setLight(light1.get());
> >     satLightSource1->setLocalStateSetModes( osg::StateAttribute::ON );
> >     satLightSource1->getOrCreateStateSet()->setMode(GL_LIGHTING,
> > osg::StateAttribute::ON);
> >
> >     osg::LightModel* lightModel1 = new osg::LightModel;
> >     lightModel1->setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f));
> > //0,0,0,1
> >     satLightSource1->getOrCreateStateSet()->setAttribute(lightModel1);
> >
> >     group->addChild(satLightSource1);
> >
> >     _root->getOrCreateStateSet()->setMode(GL_LIGHT1,
> > osg::StateAttribute::ON);
> >
> > When I modify quadratic attenuation and linear attenuation, nothing
> appear
> > to be changed in the scene, and a lot of nodes are lighted in red...
> >
> > Some idea why it doesn't works ?
> > Thanks,
> >
> > Regards,
> > Vincent.
> >
> > _______________________________________________
> > 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
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to