About FeatureNode Translucent

classic Classic list List threaded Threaded
1 message Options
KaiTang KaiTang
Reply | Threaded
Open this post in threaded view
|

About FeatureNode Translucent

 Hello everyone,
  First,I create a osgEarth::Symbology::Geometry and push_back some point.Then use this geometry to create feature and then use this feature to create featureNode.The style  set like this:

  style.getOrCreate<ExtrusionSymbol>()->height() = 25000.0;
  style.getOrCreate<PolygonSymbol>()->fill() ->color() = Color(... , 0.25);

The translucent part :
  stateset->setMode(GL_BLEND,osg::StateAttribute::ON);
  stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
  osg::Material* mat = new Material();
  mat->setDiffuse(Material::FRONT_AND_BACK,osg::Vec4(1.0,1.0,1.0,1.0));
  mat->setAmbient(Material::FRONT_AND_BACK,osg::Vec4(1.0,1.0,1.0,1.0));
  mat->setTransparency(Material::FRONT_AND_BACK,1.0);

  stateset->setAttributeAndModes(mat,StateAttribute::OVERRIDE|StateAttribute::ON);
  stateset->setRenderingHint(StateSet::TRANSPARENT_BIN);
  stateset->setMode(GL_DEPTH_TEST,StateAttribute::ON);//this must set it on,or will see the featurenode through the terrain.

this is normal
but in orther viewpoint like this ,it's wrong.
the other is like this Inside one of the cubes, it's right to look in every direction.

how to solve this error display.

Thanks.