Hello,
I have an osg::ProxyNode model that I change the material on then I try to
update the file itself so that next time I run the program the changes persist.
If I save it to my_model.osgb then the next time I go to open it
osgDB::readNodeFile locks up trying to read the file, however if I save it to a
.3ds, open that and then save it to .osgb then it loads up fine the next time.
Is this a bug in the way materials are written to .osgb? It seems like writing
to each format should act the same. My version of OSG is 3.1.6.
Here is my code that does work replace .3ds with .osgb and it will fail when
reloaded:
Code:
void M_model::Set_material(void)
{
osg::ref_ptr<osg::Material> mtl = new osg::Material;
float alpha = 0.3f;
mtl->setAmbient(osg::Material::FRONT, osg::Vec4(0.75f, 0.53f, 0.19f,
alpha));
mtl->setDiffuse (osg::Material::FRONT, osg::Vec4(0.75f, 0.53f, 0.19f,
alpha));
mtl->setSpecular(osg::Material::FRONT, osg::Vec4(0.75f, 0.53f, 0.19f,
alpha));
mtl->setAlpha(osg::Material::FRONT_AND_BACK, alpha);
mtl->setShininess(osg::Material::FRONT, 1.0f);
osg::StateSet* ss = _prox_node->getOrCreateStateSet();
ss->setAttributeAndModes(mtl.get(),
osg::StateAttribute::OVERRIDE|osg::StateAttribute::ON);
ss->setMode(GL_DEPTH_TEST,osg::StateAttribute::ON);
ss->setMode(GL_LIGHTING,osg::StateAttribute::ON);
ss->setMode(GL_BLEND,osg::StateAttribute::ON);
ss->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
if(boost::filesystem::exists(_file_name))
{
boost::filesystem::remove(_file_name);
}
osgDB::writeNodeFile(*_prox_node, "../Models/frame_6.3ds");
}
Thanks,
Patrick
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=56533#56533
Attachments:
http://forum.openscenegraph.org//files/frame_6_new_mtl_174.png
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org