Paul Melis wrote:
> Paul Melis wrote:
>> Hi Robert,
>>
>> Robert Osfield wrote:
>>> I would like to finish this week with a 2.7.9 dev release, could users
>>> do a check out of svn/trunk and let know if your build succeeds/or
>>> where it fails.
>>>   
>> Not really a build failure of such, but could you take a look at the
>> example I posted in the thread "Re: [osg-users] Statesets with
>> renderBin make sub-models invisible", dated 01/22/2009 10:18 AM.
>> Either I'm misunderstanding overriding of stateset attributes or
>> something weird is going on.
> Yaiks, I did testing of the code in that post with 2.6. I'll retry
> with SVN tonight, to see if the behaviour shows there as wel..
Ok, with SVN the behaviour is the same, i.e. not all Geometries are
using the material override (see attachement), nor is the OVERRIDE value
saved to the output file mat.osg.

Paul
#include <osg/Material>
#include <osg/StateSet>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>
#include <osgViewer/Viewer>

int main()
{
    osg::ref_ptr<osg::Node>     model;

    model = osgDB::readNodeFile("dumptruck.osg");

    osg::ref_ptr<osg::Material> mat;
    mat = new osg::Material();
    mat->setColorMode(osg::Material::AMBIENT_AND_DIFFUSE);
    mat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(0, 0.99, 0.9, 0));

    osg::StateSet *ss = model->getOrCreateStateSet();
    ss->setAttributeAndModes(mat.get(), 
osg::StateAttribute::ON|osg::StateAttribute::OVERRIDE);

    osgDB::writeNodeFile(*(model.get()), "mat.osg");

    osgViewer::Viewer   viewer;

    viewer.setSceneData(model.get());
    viewer.run();
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to