[osg-users] Disbling GL_LIGHTING disables GL_BLEND
Beldyuga Ivan
beldiv at ya.ru
Sun Dec 25 00:44:22 PST 2016
Hi, code fragment of my scene loader. 2 components of object: 'NoLighting' and 'Opacity' can not combine, I am not understand why. They work well alone.
Code:
auto* object_states = object.graphics -> getOrCreateStateSet();
if(OpacityComponentFound)
{
auto* opacity_material = new osg::Material();
opacity_materia->setAlpha( osg::Material::FRONT, 0.5f );
object_states->setAttributeAndModes( opacity_material, osg::StateAttribute::OVERRIDE );
object_states->setMode( GL_BLEND, osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE );
object_states->setRenderingHint( osg::StateSet::TRANSPARENT_BIN );
object_states->setAttributeAndModes( blend_func );
}
if(NoLighting)
{
object_states->setMode( GL_LIGHTING, osg::StateAttribute::OFF | osg::StateAttribute::OVERRIDE );
}
...
Thank you![/code]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=69761#69761
More information about the osg-users
mailing list