how to use overlaynode?

classic Classic list List threaded Threaded
2 messages Options
Calvert Calvert
Reply | Threaded
Open this post in threaded view
|

how to use overlaynode?

First i'm very appreciate for all your helps!!Thanks.

I want to use overlaynode to draw a curved polygon on the top of terrain,
and just like the osgSimulation example, but it doesn't work properly.

attached: snipped code:
"root" isn't a CoordinateSystemNode??  is this the problem???

osgSim::OverlayNode::OverlayTechnique technique
       = osgSim::OverlayNode::OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY;
osgSim::OverlayNode* overlayNode = new osgSim::OverlayNode(technique);
overlayNode->getOrCreateStateSet()->setTextureAttribute(1, new osg::TexEnv(osg::TexEnv::ADD));
overlayNode->setOverlaySubgraph(geode);
overlayNode->setContinuousUpdate(true);
overlayNode->setOverlayTextureSizeHint(1024);
overlayNode->setOverlayTextureUnit(1);

// insert the OverlayNode between the coordinate system node and its children.
for(unsigned int i=0; i<root->getNumChildren(); ++i)
{
        overlayNode->addChild( root->getChild(i) );
}
root->removeChildren(0, root->getNumChildren());
root->addChild(overlayNode);

any ideas??
thanks again!!

calvert
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: how to use overlaynode?

No, "root" is not a CSN. Try calling MapNode::findCoordinateSystemNode(root).

Glenn
Pelican Mapping
Glenn Waldron / Pelican Mapping