Hi,

I think you made a mistake when setting up the scenegraph. Add
updateText to your pat, and add the pat to your hud.

HTH,
Stephan

Am 31.07.12 22:10, schrieb Yonas Sahlemariam:
> Hi,
> 
> I was wondering if somebody made animation on HUD. 
> 
> basically, I am modifying osgpick example trying to animate the 5 geometries 
> rendered as HUD. I am using PositionAttitudeTransform, but all I got is the 
> static geometries.  Is it impossible to animate 2D nodes rendered as HUD, 
> please hint me if I am missing something?
> 
>  Here is the code
> 
> 
> osg::PositionAttitudeTransform *pat;
> 
> /* update function*/
> 
> void update(float dt) {
>     pat->setPosition(osg::Vec3(dt, dt, 0));
> 
> }
> 
> 
> /* main function */
> 
> int main()
> {
> 
> ....
> 
>     osg::ref_ptr<osgText::Text> updateText = new osgText::Text;
> 
>     // add the HUD subgraph.   
>       osg::ref_ptr<osg::Node> hudCam = createHUD(updateText.get());
>       
>       // position attitude transform
>       pat = new osg::PositionAttitudeTransform;
>       pat->setPosition(osg::Vec3(0,0,0));
>       pat->addChild(hudCam);
> 
>     group->addChild(pat);
> 
>     osgViewer::Viewer viewer;
>       
>           // set the scene to render
>     viewer.setSceneData(group.get());
> 
>       viewer.setCameraManipulator( new osgGA::TrackballManipulator() );
>       viewer.addEventHandler(new osgViewer::StatsHandler);
>     // add the handler for doing the picking
>     viewer.addEventHandler(new PickHandler(updateText.get()));
> 
>       viewer.realize();
> 
>       while(!viewer.done())
>       {
>               viewer.frame();
>               update(0.005);
>       }
>  
> }  
> ... 
> 
> Thank you!
> 
> Cheers,
> Yonas
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=49122#49122
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to