Hi,
This is a very simple piece of code and I don't understand why I having some
artifacts.
I am trying to show a transparent box around the loaded model.
Code:
_root = new osg::Group();
osg::Node * part = osgDB::readNodeFile("D:\\3rd Party
Downloads\\OpenSceneGraph-2.9.9\\Data\\Stock_0.stl");
osg::BoundingBox bb;
bb.expandBy( part->asGeode()->getDrawable(0)->getBound() );
double l = bb.xMax() - bb.xMin();
double w = bb.yMax() - bb.yMin();
double h = bb.zMax() - bb.zMin();
ShapeDrawable * drawable = new ShapeDrawable( new Box(bb.center(), l, w, h) );
drawable->setColor(osg::Vec4(.5,.5,.5,.5));
osg::Node * workpiece = new osg::Geode();
workpiece->asGeode()->addDrawable( drawable);
workpiece->getOrCreateStateSet()->setMode(GL_BLEND,osg::StateAttribute::ON);
workpiece->getOrCreateStateSet()->setRenderingHint(StateSet::TRANSPARENT_BIN);
_root->asGroup()->addChild(part);
_root->asGroup()->addChild(workpiece);
If I change the order in the group workpiece before part then I don't have
anymore problem.
Shouldn't the renderBin have sorted the object? Why the result depends on the
order of my objects in the group.
...
Thank you!
Cheers,
Dominique
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34228#34228
Attachments:
http://forum.openscenegraph.org//files/transparency_problem_848.jpg
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org