Hi Daniel,

the text HUD shows up correctly.
Only the wallpaper is missing. I create it by a separate camera in 
PRE-RENDERmode. Here ist the code snippplet:

===============================================

/** This method creates a HUD-Window for a wallpaper */
void Cl_3Dview_osg::createWallpaper(const QString &_path) {
    osgViewer::Viewer::Windows windows;
    view->getWindows(windows);
    if (windows.empty()) return;

    // ===========================================
    // Create camera
    // ===========================================
    // 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,1,0,1));
    camera->setProjectionResizePolicy(osg::Camera::FIXED);

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

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

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

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

    // set up cameras to rendering on the first window available.
    camera->setGraphicsContext(windows[0]);
    camera->setViewport(0,0,windows[0]->getTraits()->width, 
                                    windows[0]->getTraits()->height);

    view->addSlave(camera, false);

    wallpaperCamera = camera;
    if (!_path.isEmpty())
        setWallpaper(_path);
    // The main camera should not wipe out the wallpaper
    view->getCamera()->setClearMask(GL_DEPTH_BUFFER_BIT);
}
===============================================

Is there any better method to do this job, maybe by a separate node in a low 
numbered render bin? But what about the transformations then and the resize 
handling of the viewport?


Thank you!

Cheers,
Werner

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





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

Reply via email to