[osg-users] different materials for a geometry and highlight
Gianni Ambrosio
g.ambrosio+osg at gmail.com
Tue Sep 6 07:32:10 PDT 2016
Dear All,
I currently draw graphics with:
osg::Geometry* geometry = getGeometry();
geometry->setVertexArray(vertices);
geometry->addPrimitiveSet(elements);
where:
osg::Vec3Array* vertices = new osg::Vec3Array;
osg::DrawElementsUInt* elements = new osg::DrawElementsUInt(osg::PrimitiveSet::TRIANGLES);
I build vertices and elements based on an underlying model. I draw the geometry in a neutral gray color.
Now I need to apply some material information, got from the underlying model, on the osg::Geometry, so that it is not uniformly gray.
I have a list of possible materials each of them should be visualized with a different color.
Moreover the user could interact with the 3D surface selecting the 3D primitives and changing the material (so the color) to them. That chang will be stored then on the underlying model.
It would be fine also to highlight the selected trinagles of the geometry (transparent-white for example) to chenge the material.
Looking around I thought to solve the problem with different primitive sets, one for each material.
About highlighting the selection I found a topic where Robert suggested to use a dedicated osg::Geometry:
http://forum.openscenegraph.org/viewtopic.php?t=13347&view=previous
Any other (better) idea?
Best regards,
Gianni
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=68532#68532
More information about the osg-users
mailing list