Thanks for your reply Jason,

I actually worked this out I think, I removed mat->setDiffuse and added

mat->setColorMode(osg::Material::ColorMode::DIFFUSE) and it seemed to do the
trick!

Not sure why, but hey, it works. I now have a shared stateset with various
attributes like specular/backface culling etc... and vertex colors on the
objects themselves

:)


On Fri, Jul 17, 2009 at 6:50 PM, Jason Daly <[email protected]> wrote:

>
>
> Hi, Andrew,
>
>
> Andrew Burnett-Thompson wrote:
>
>> // Set specular attribute
>> mat->setDiffuse(osg::Material::Face::FRONT_AND_BACK, osg::Vec4(0,0,0,0));
>> mat->setSpecular(osg::Material::FRONT, osg::Vec4f(1.0f, 1.0f, 1.0f,
>> 1.0f));
>> mat->setShininess(osg::Material::FRONT, 12.0f);
>> mat->setColorMode(osg::Material::ColorMode::SPECULAR);
>> sharedState->setAttribute(mat.get(), osg::StateAttribute::Values::ON);
>> sharedState->setMode(GL_COLOR_MATERIAL, osg::StateAttribute::ON);
>> ///////////////////////
>>
>> Of course, the material then mixes its color with the vertex color,
>> despite the fact that its transparent.
>>
>
> Try adding this to your global StateSet:
>
> osg::LightModel *lm =new osg::LightModel();
> lm->setColorControl(osg::LightModel::SEPARATE_SPECULAR_COLOR);
> stateset->setAttributeAndModes(lm, osg::StateAttribute::ON);
>
>
> I'm not sure if it'll work, but it's all I can think of...
>
>
> --"J"
>
>
> _______________________________________________
> 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