You could try to use OVERRIDE:
TerrainState->setAttribute(pTerrainPolygonMode ,
osg::StateAttribute::ON | osg::StateAttribute::OVERRIDE) ;
just to make sure that the pTerrainNode doesnt define these states
further down in the scene.
/Anders
On 6/12/07, Robert Osfield <[EMAIL PROTECTED]> wrote:
HI Siddarh,
I don't know where to start, simply don't know enough what is the
problem or your implementation to know whats up.
There is the osgGA::StateSetManipulator that does something very
similar and its works so have a look at it.
Robert.
On 6/11/07, Siddharth Palaniappan <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I'm trying to use a keyboard handler class to toggle wireframe , texture , lighting
etc. I followed the online tutorials and this is what i did - i created a new class derived
from GUIEventHandler. and overid the "handle" function.
>
> osg::StateSet* TerrainState =
pTerrainNode->getOrCreateStateSet() ;
> TerrainState->clear() ;
>
> osg::PolygonMode* pTerrainPolygonMode = NULL ;
> pTerrainPolygonMode = dynamic_cast<osg::PolygonMode*>
(TerrainState->getAttribute(osg::StateAttribute::POLYGONMODE)) ;
>
> if(pTerrainPolygonMode == NULL)
> {
> pTerrainPolygonMode = new osg::PolygonMode() ;
> }
>
> pTerrainPolygonMode->setMode(osg::PolygonMode::FRONT_AND_BACK
, osg::PolygonMode::FILL) ;
> TerrainState->setAttribute(pTerrainPolygonMode ,
osg::StateAttribute::ON) ;
>
>
> The inherited keyboard handler class has pTerrainNode which gets the address
of the geometry node in its constructor..
>
> I had already set the attributes prior to rendering as lines. Now i want to
render it as filled polygons or points...when invoking the keyboard handler , this
is what i did..(in the main function)
>
>
> TerrainKeyboardEventHandler *keh = new
TerrainKeyboardEventHandler(root.get()) ;
> osgViewer::Viewer viewer ;
>
> viewer.setSceneData( root.get() ) ;
> viewer.addEventHandler(keh) ;
>
> keh->AddFunction('w' , RenderWireframe) ;
> keh->AddFunction('v' , RenderPoints) ;
> .
> .
> .
>
>
> I dont understand what is wrong..I am using Visual Studio 2005 , osg 1.9.7 on
xp.
>
> Any hints , tips or suggestions would greatly help me. Thanks.
>
>
> Siddharth
>
>
>
>
>
____________________________________________________________________________________Ready
for the edge of your seat?
> Check out tonight's top picks on Yahoo! TV.
> http://tv.yahoo.com/
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/
>
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
--
________________________________________________________________
Anders Backman Email: [EMAIL PROTECTED]
HPC2N/VRlab Phone: +46 (0)90-786 9936
Umea university Cellular: +46 (0)70-392 64 67
S-901 87 UMEA SWEDEN Fax: +46 90-786 6126
http://www.cs.umu.se/~andersb
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/