Hi Rahul and osg-users,

I've recently tried to use overlaynode with blending and i didn't achieve to
make it work...

Is there someone who has a simple sample file with data to show the
community how overlay node works when it comes to set some blending between
overlay and overlay subgraph ??

Kind regards,

2008/8/7 Rahul Jain <rah...@darshan3d.com>

> Hi all,
> I am trying to overlay a shape file on a terrain  using overlay node.  But
> the  two textures are not blending, instead the overlay texture has replaced
> the terrain texture. I am attaching the final rendered image for you to
> ponder upon.  I am  using the code of osgsimulation example which goes like
> this for my case.
>
> // Get coordinate system node
> osg::CoordinateSystemNode* csn =
> dynamic_cast<osg::CoordinateSystemNode*>(terrain.get());
>
> // Set overlay technique
> osgSim::OverlayNode::OverlayTechnique technique =
> osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY;
>
> // Create overlay node
> osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode(technique);
>
> // Set blending parameters
> overlayNode->getOrCreateStateSet()->setRenderingHint(osg::StateSet::TRANSPARENT_BIN);
>
> overlayNode->getOrCreateStateSet()->setMode(GL_BLEND,
> osg::StateAttribute::ON);
>
> overlayNode->getOrCreateStateSet()->setTextureAttribute(1, new
> osg::TexEnv(osg::TexEnv::BLEND));
> overlayNode->setOverlaySubgraph(shapefile.get());
> overlayNode->setOverlayTextureSizeHint(1024);
> overlayNode->setOverlayTextureUnit(1);
>
> // Set clear color
> overlayNode->setOverlayClearColor(osg::Vec4(0.0, 0.0, 0.0, 0.0));
>
> // insert the OverlayNode between the coordinate system node and its
> children.
> for(unsigned int i=0; i<csn->getNumChildren(); ++i)
> {
>       overlayNode->addChild( csn->getChild(i) );
> }
>
> csn->removeChildren(0, csn->getNumChildren());
> csn->addChild(overlayNode);
>
> // Set scene data
> viewer.setSceneData(csn);
>
>
>
> best regards
> RJ
>
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Alexandre AMALRIC                   Ingénieur R&D
===================================
PIXXIM S.A. 73E, rue Perrin-Solliers 13006 Marseille
http://www.pixxim.fr
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to