Hi Gianni,

I had a similar problem in the past, and it was related to the camera
clipping.
In my case it was enough to move the axes "inside" the screen, as shown in
the following code snippet:

        // create a camera to set up the projection and model view matrices,
and the subgraph to drawn in the HUD
        osg::Camera* camera = new osg::Camera;

        // set the projection matrix
        camera->setProjectionMatrix(osg::Matrix::ortho2D(0,1280,0,1024));

        // set the view matrix
        camera->setReferenceFrame(osg::Transform::ABSOLUTE_RF);
        camera->setViewMatrix(osg::Matrix::identity());

        // only clear the depth buffer
        camera->setClearMask(GL_DEPTH_BUFFER_BIT);

        // draw subgraph after main camera view.
        camera->setRenderOrder(osg::Camera::POST_RENDER);

        // we don't want the camera to grab event focus from the viewers
main camera(s).
        camera->setAllowEventFocus(false);

        // put the axes under the hud transformation node
        hudAxesTransform = new osg::PositionAttitudeTransform();
        hudAxesTransform->setPosition(osg::Vec3(80,50,-100)); // put
"inside" the scren (z=-100) to avoid clipping
        hudAxesTransform->addChild(graphics::utils::createAxes(0.5));
        osg::StateSet *state = hudAxesTransform->getOrCreateStateSet();
        state->setMode(GL_LIGHTING, osg::StateAttribute::OFF);

        // add to the hud camera a subgraph to render and add to the main
graph
        camera->addChild(hudAxesTransform);
        root->addChild(camera);

ciao,
Davide

---------- Forwarded message ----------
> From: "Gianni Ambrosio" <[email protected]>
> To: [email protected]
> Date: Thu, 01 Jul 2010 09:35:29 +0000
> Subject: Re: [osg-users] cross axes
> Thanks Nick,
> I implement it but some modifications caused another problem I don't
> understand.
>
> (...)
>
> Now the problem.
> On top of each axis an osgText to diplays the labels X, Y and Z. When an
> axis points towards out of the screen (more or less) the label disappears.
> In the previous implementation with axis size=1.5 it worked correctly. Can
> you please explain me why?
>
> Regards
> Gianni
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to