hi all (and hi dirk, thx 4 the greeting in the skybgd message),
I spent the past week setting up a material parser
which loads from some xml files a collection of
materials, along with the relative shaders.
I've put the whole stuff in a <vector> of MaterialDescriptor
classes, with every single object holding a ChunkMaterialPtr
pointing to the the appropriate material.
Here is the problem: i want to switch the materials on the fly,
via a fox simple interface. I have for now 4 simple materials.
When i engage the materials the first time, all goes good, so i can kick
in material 1, 2, 3, 4 and all are displayed correctly.
The problem starts when i put back on a material that
was already displayed.
For example if i switch on materials 1,3,4,3, when i put on the
3rd material again, my app crashes, every time.
I switch the materials with a simple:
for (int
materialNum=0;materialNum<m_MaterialDescriptor.size()&&trovato!=TRUE;materialNum++)
{
if(!strcmp(str.text(),m_MaterialDescriptor[materialNum]->GetMaterialName()))
{
osg::beginEditCP(group);
group->setMaterial(m_MaterialDescriptor[materialNum]->GetChunkMaterial());
osg::endEditCP(group);
if(m_MaterialDescriptor[materialNum]->GetChunkMaterial()==osg::NullFC)
printf ("No pointer\n");
if (group==osg::NullFC)
printf ("no group\n");
trovato=TRUE;
}
my first guess is that the material pointers go somehow lost in the
assign part, but as long as they are different from NullFC it should
work... Weird thing...
any ideas?
thanks for the help, enrico
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users