maybe better to put something in while we can compile and test and see if
can help - including the model

-Nick


On Mon, Oct 4, 2010 at 5:37 PM, Aitor Ardanza <[email protected]> wrote:

>
> ledocc wrote:
> > Is you normal of your model well defined and normalized ?
>
> Whitout shaders model looks perfect, and you can see the changes moving the
> light of the site.
>
> ledocc wrote:
> >
> > I suppose you used an osg::Light to define your light.
> > Have you put it in a osg::LightSource ?
> >
>
>
> Code:
> int const LIGHTS = 1;
>    osg::StateSet *lightStateSet = scene->getOrCreateStateSet();
>    osg::Geode *lightMarker[LIGHTS];
>    osg::LightSource *lightSource[LIGHTS];
>    // Create Lights
>    osg::Vec4 lightColors[] = {osg::Vec4(1.0,1.0,1.0,1.0), osg::Vec4(0.0,
> 1.0, 0.0, 1.0), osg::Vec4(0.0, 0.0, 1.0, 1.0)};
>
>    for (int i = 0; i < LIGHTS; i++) {
>        lightMarker[i] = new osg::Geode();
>        lightMarker[i]->addDrawable(new osg::ShapeDrawable(new
> osg::Sphere(osg::Vec3(0.0, 40.0, 0.0), 5.0)));
>        osg::Material *light_material = new osg::Material();
>        light_material->setDiffuse(osg::Material::FRONT,  osg::Vec4(1.0,
> 1.0, 1.0, 1.0));
>        light_material->setSpecular(osg::Material::FRONT,  osg::Vec4(0.1,
> 0.1, 0.1, 1.0));
>        light_material->setEmission(osg::Material::FRONT, lightColors[i]);
>        lightMarker[i]->getOrCreateStateSet()->setAttribute(light_material);
>
>        lightSource[i] = new osg::LightSource();
>        osg::Light *light = new osg::Light();
>        // each light must have a unique number
>        light->setLightNum(0);
>        // we set the light's position via a PositionAttitudeTransform
> object
>        light->setPosition(osg::Vec4(0.0, 40.0, 0.0, 0.3));
>        light->setSpecular(osg::Vec4(0.1,0.1,0.1,1.0));
>        light->setAmbient( osg::Vec4(0.2,0.2,0.2,1.0));
>        light->setDiffuse(lightColors[i]);
>        lightSource[i]->setLight(light);
>        lightSource[i]->setLocalStateSetModes(osg::StateAttribute::ON);
>        lightSource[i]->setStateSetModes(*lightStateSet,
> osg::StateAttribute::ON);
>
>        lightTransform[i] = new osg::PositionAttitudeTransform();
>        lightTransform[i]->addChild(lightSource[i]);
>        lightTransform[i]->addChild(lightMarker[i]);
>        lightTransform[i]->setPosition(osg::Vec3(0, 0,200));
>        //lightTransform[i]->setScale(osg::Vec3(0.1,0.1,0.1));
>
>        scene->addChild(lightTransform[i]);
>     }
>
>
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=32364#32364
>
>
>
>
>
> _______________________________________________
> 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

Reply via email to