Re: [osg-users] problem using overlay node

2009-04-01 Thread Alexandre Amalric
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_castosg::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; icsn-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 RD
===
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


[osg-users] problem using overlay node

2008-08-07 Thread Rahul Jain

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_castosg::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; icsn-getNumChildren(); ++i)
{
   overlayNode-addChild( csn-getChild(i) );
}

csn-removeChildren(0, csn-getNumChildren());
csn-addChild(overlayNode);

// Set scene data
viewer.setSceneData(csn);



best regards
RJ
inline: combined.png___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org