Hi,

I thought this would be extremely trivial. But, perhaps I am missing something. 
I have a HUD ortho2D camera slaved to a main view window camera, rendering a 
polygon. I need to move the polygon when I resize the main window, which I 
attempted by simply placing the geode underneath a MatrixTransform node, first 
setting it to identity() and placing it under the HUD camera. However, when I 
did this, the polygon no longer is rendered in the window at all. 

Note that everything renders fine with a Geode before I placed it under the 
MatrixTransform. 

To recap this is essentially what I tried:

m_HUDcam = new osg::Camera;

         m_HUDcam->setProjectionMatrix( osg::Matrix::ortho2D(0,           
m_viewersize.GetX(),0, m_viewersize.GetY()));

        m_HUDcam->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    
        m_HUDcam->setClearMask(GL_DEPTH_BUFFER_BIT);

        // draw subgraph after main camera view.

        m_HUDcam->setRenderOrder(osg::Camera::POST_RENDER,0);

        m_HUDcam->setAllowEventFocus(false);

        // create the frame

        osg::MatrixTransform * matrixtransfm = new osg::MatrixTransform;
        matrixtransfm->setMatrix(osg::Matrix::identity());
        
        // create the Geode (Geometry Node) to contain all our  osg::Geometry 
objects.
        osg::Geode* geode = new osg::Geode();
        osg::StateSet* stateset = geode->getOrCreateStateSet();
         stateset->setMode(GL_LIGHTING,osg::StateAttribute::OFF);
        matrixtransfm->setChild(0, geode);

      // <.... construct the polygon(s) primitive(s) here ...>
      
     // attach it to the HUD camera -- now the polygon(s) don't display.
     m_HUDcam->addChild(matrixtransfm);

     // but uncommenting this out, and polygon displays :
     // m_HUDcam->addChild(geode);

     // viewport, etc.
     m_HUDcam->setViewport(  0 ,0, m_viewersize.GetX(),       
m_viewersize.GetY());

     m_HUDcam->setGraphicsContext(gw);

     m_viewer->addSlave(m_HUDcam, false);

     

 

Thank you!

Cheers,
Ted

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=33347#33347





_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to