Thanks Robert.
I tried not setting any clear mask on the slave camera and making sure the depth clear was on my main camera. I haven't got the desired effect yet.
My main camera has these settings:
Camera mainCam = new Camera(*(view->getCamera()));
mainCam->setGraphicsContext(osg::GraphicsContext::createGraphicsContext(traits->get()));
mainCam->setViewMatrixAsLookAt(eye, center, up);
mainCam->setViewport(0, 0, screen->width(), screen->height());
mainCam->setClearColor(clearColor);
mainCam->setClearMask(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
mainCam->setRenderOrder(osg::Camera::POST_RENDER);
mainCam->setComputeNearFarMode(osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
HUD Camera has these settings:
Camera hudCam = new Camera();
hudCam->setGraphicsContext(osg::GraphicsContext::createGraphicsContext(t->get()));
hudCam->setViewport(0, 0, screen->width(), screen->height());
hudCam->setRenderOrder(osg::Camera::PRE_RENDER);
hudCam->setAllowEventFocus(false);
hudCam->addChild(HUD);
hudCam->addChild(lights->getLight());
I attached a screen shot of what it looks like. The hand is always underneath my HUD. I've tried playing around with a lot of different settings, with the buffer bit and color bit but to no avail :(
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=61682#61682