I created an HUD with the following code:

Code:

   //SETUP HUD
   m_rootHUD = new osg::Group();
   // create a camera to set up the projection and model view matrices, and the 
subgraph to drawn in the HUD
    m_cameraHUD = new osg::Camera;
    // set the projection matrix
    m_cameraHUD->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));
    // set the view matrix    
   m_cameraHUD->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
    m_cameraHUD->setViewMatrix(osg::Matrix::identity());
    // only clear the depth buffer
    m_cameraHUD->setClearMask(GL_DEPTH_BUFFER_BIT);
    // draw subgraph after main camera view.
    m_cameraHUD->setRenderOrder(osg::Camera::POST_RENDER);
    // we don't want the camera to grab event focus from the viewers main 
camera(s).
    m_cameraHUD->setAllowEventFocus(false);
   m_cameraHUD->addChild(m_rootHUD);

   osgViewer::Viewer::Windows windows;
    m_viewer->getWindows(windows);        
    if (windows.empty())
   {
      std::cout << "error: no windows\n";
      exit(1);
   }                
    // set up cameras to rendering on the first window available.
    m_cameraHUD->setGraphicsContext(windows[0]);
    m_cameraHUD->setViewport(0,0,windows[0]->getTraits()->width, 
windows[0]->getTraits()->height);



Then I add some stuff to the group root node.  Then I add the camera to the 
viewer with the following code.


Code:

unsigned int slaveID = m_viewer->getNumSlaves();
m_viewer->addSlave(m_cameraHUD, false);




Now, when I decide I want to remove the HUD with the following code, it removes 
but the HUD is still visible.


Code:
if (!m_viewer->removeSlave(slaveID))
{
   std::cout << "error removing slave " << slaveID << "\n";
   exit(1);
}

        

Shouldn't that command remove the HUD from the screen?

Thank you
Brian[/code]

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





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

Reply via email to