robertosfield wrote:
> HI Jamie,
> 
> When using shaders it's the shader itself that controls the lighting
> so the standard OpenGL lighting modes won't affect it.
> 
> If you want to toggle lighting in shaders you'll need to assign a
> different shader or use a uniform that controls whether lighting is
> applied or not.
> 
> Robert.
> 
> On 12 June 2014 10:21, Jaime <> wrote:
> 
> > Hi,
> > 
> > I want to disable specific lights with OSG, and it affects models with 
> > shaders. How can I do it?
> > 
> > What I have now, it is not working. I apply shaders with:
> > 
> > osg::StateSet* stateset = new osg::StateSet;
> > [...load shader...]
> > stateset->setAttributeAndModes(programObject, osg::StateAttribute::ON | 
> > osg::StateAttribute::OVERRIDE);
> > m_pDrawable->setStateSet(stateset);
> > 
> > In execution, I wanto to disable some lights, and this change has to affect 
> > shader (in the shader I have two lights). But, when I disable light in OSG, 
> > it doesn't work. I have tested with and no succes:
> > ss->setMode(GL_LIGHTING, osg::StateAttribute::PROTECTED | 
> > osg::StateAttribute::OFF);
> > ss->setMode(GL_LIGHTING, osg::StateAttribute::PROTECTED | 
> > osg::StateAttribute::OFF);
> > model->GetNode()->getOrCreateStateSet()->setMode(GL_LIGHT1, 
> > osg::StateAttribute::OFF);
> > 
> > If I test with "normal" models (without shaders), it works. But the problem 
> > is with shaders. Do I have to turn off light in OpenGL?
> > 
> > Thank you!
> > 
> > ------------------
> > Read this topic online here:
> > http://forum.openscenegraph.org/viewtopic.php?p=59711#59711
> > 
> > 
> > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> _______________________________________________
> osg-users mailing list
> 
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 
>  ------------------
> Post generated by Mail2Forum


Thank you very much Robert! It worked!  :D 
I am using uniforms.

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=59753#59753





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to