<div dir="ltr"><div>Hi,</div>
<div> </div>
<div>isnt there missing a </div>
<div><b><font color="#000000">setMode</font></b><font color="#990000">(</font> GL_LIGHT1<font color="#990000">,</font> osg<font color="#990000">::</font>StateAttribute<font color="#990000">::</font>ON <font color="#990000">);</font></div>

<div><font color="#990000"></font> </div>
<div><font color="#990000">for your terrain group? (or did I miss something?)</font></div>
<div><font color="#990000"></font> </div>
<div><font color="#990000">Peter</font></div>
<div><font color="#990000"><a href="http://osghelp.com/">http://osghelp.com</a></font></div>
<div><br><br><br></div>
<div class="gmail_quote">On Sat, Jul 19, 2008 at 12:39 AM, Ümit Uzun <<a href="mailto:umituzun84@gmail.com">umituzun84@gmail.com</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div dir="ltr">Hi All,<br><br>I have an simple question about light the terrain model problem. I have added two sphere(osg::Sphere) and one terrain(JoeDirt.flt) to the scene. I am trying to effect the components of scene with green light. Although green light could effected two of sphere,  couldn't get<span style="BACKGROUND-COLOR: rgb(255,0,0)"></span> success on the terrain model. What can I do to effect the terrain with green light? I have tried this code block;<br>
<br>--------------------------------------------------------------------------------------------------------------------------------------------------<br><b>int main()<br>{<br>        osgViewer::Viewer viewer;<br>    osg::ref_ptr<osg::Group> root (new osg::Group);<br>
<br>    osg::ref_ptr<osg::MatrixTransform> terrainScaleMAT (new osg::MatrixTransform);<br>    osg::Matrix terrainScaleMatrix;<br>     terrainScaleMatrix.makeScale(0.05f,0.05f,0.03f);<br>    <br>    //Lighting code<br>
    osg::ref_ptr<osg::Group> lightGroup (new osg::Group);<br>    osg::ref_ptr<osg::StateSet> lightSS (root->getOrCreateStateSet());<br>    osg::ref_ptr<osg::LightSource> lightSource1 = new osg::LightSource;<br>
    <br>    // create a local light.<br>    osg::Vec4f lightPosition (osg::Vec4f(0.0,0.0,3.0,1.0f));<br>      osg::ref_ptr<osg::Light> myLight = new osg::Light;<br>    myLight->setLightNum(1);<br>    myLight->setPosition(lightPosition);<br>
        myLight->setAmbient(osg::Vec4(0.2f,0.2f,0.2f,1.0f));<br>        myLight->setDiffuse(osg::Vec4(0.1f,0.4f,0.1f,1.0f));<br>        myLight->setConstantAttenuation(1.0f);<br>    lightSource1->setLight(myLight.get());<br>
<br>    lightSource1->setLocalStateSetModes(osg::StateAttribute::ON); <br>    lightSource1->setStateSetModes(*lightSS,osg::StateAttribute::ON);    <br>    <br>    lightGroup->addChild(lightSource1.get());<br>    <br>
    //Light markers: small spheres<br>    osg::ref_ptr<osg::Geode> lightMarkerGeode (new osg::Geode);<br>    lightMarkerGeode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3f(-5.0f,-2.0f,3.0f),0.5f)));<br>
<br>    //lightMarkerGeode->getOrCreateStateSet()->setMode(GL_LIGHTING,osg::StateAttribute::OFF);<br>    <br>    //Second light marker<br>    lightMarkerGeode->addDrawable(new osg::ShapeDrawable(new osg::Sphere(osg::Vec3f(2.0f,-1.0f,3.0f),0.5f)));<br>
<br>    //Loading the terrain node<br>    osg::ref_ptr<osg::Node> terrainnode (osgDB::readNodeFile("JoeDirt.flt"));<br>    terrainScaleMAT->addChild(terrainnode.get());<br>    terrainScaleMAT->setMatrix(terrainScaleMatrix);<br>
    <br>    //adding the terrain node to the root node<br>    root->addChild(terrainScaleMAT.get());<br>    <br>    //lighting code<br>    root->addChild(lightGroup.get());<br>    //Adding the light marker geode<br>
    root->addChild(lightMarkerGeode.get());<br><br>    // add the state manipulator<br>        viewer.addEventHandler( new osgGA::StateSetManipulator(viewer.getCamera()->getOrCreateStateSet()) );<br>    <br>    viewer.setSceneData( root.get() );<br>
<br>    return (viewer.run());<br>}</b><br>--------------------------------------------------------------------------------------------------------------------------------------------------<br></div><br>_______________________________________________<br>
osg-users mailing list<br><a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.openscenegraph.org</a><br><a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" target="_blank">http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Regards,<br>Peter Wraae Marino<br><br><a href="http://www.osghelp.com">www.osghelp.com</a> - OpenSceneGraph support site </div>