There is DepthSortedBin as well osg::ref_ptr<osg::Group> group = new osg::Group; osg::Node* one = createHUD(); // this will be your background image osg::Node* two = scene.get(); one->getOrCreateStateSet()->setRenderBinDetails(1,"DepthSortedBin"); two->getOrCreateStateSet()->setRenderBinDetails(2,"DepthSortedBin"); group->addChild(one); group->addChild(two); one->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF);
Nick http://www.linkedin.com/in/tnick Sent from Devlet, Ankara, Turkey On Sat, Dec 19, 2009 at 2:49 PM, alessandro terenzi <[email protected]>wrote: > Thank you very much Nick, it worked fine, I just changed this: > > > group > ->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); > > into this: > > one > ->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); > > Regards. > Alessandro > > > On Sat, Dec 19, 2009 at 12:42 PM, Trajce Nikolov <[email protected] > > wrote: > >> Hi Alessandro, >> >> nah. That wont do the job. I did a quick test, and here is how I made it >> work >> >> go the the osgHUD example and: >> >> 1. createHUD, set for the camera: >> camera->setRenderOrder(osg::Camera::NESTED_RENDER); >> >> 2. in main, about line 362, where you load your scene without arguments >> osg::ref_ptr<osg::Group> group = new osg::Group; >> osg::Node* one = createHUD(); // this will be your background image >> osg::Node* two = scene.get(); >> one->getOrCreateStateSet()->setRenderBinDetails(1,"RenderBin"); >> two->getOrCreateStateSet()->setRenderBinDetails(2,"RenderBin"); >> group->addChild(one); >> group->addChild(two); >> >> group->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::OFF); >> >> two->getOrCreateStateSet()->setMode(GL_DEPTH_TEST,osg::StateAttribute::ON); >> >> // add the HUD subgraph. >> //if (scene.valid()) group->addChild(scene.get()); >> //group->addChild(createHUD()); >> >> // set the scene to render >> viewer.setSceneData(group.get()); >> >> >> this is working code. Might be another way, but this will help you I think >> >> Let me know if it works for you >> >> Nick >> >> http://www.linkedin.com/in/tnick >> Sent from Ünalan, İstanbul, Turkey >> >> On Sat, Dec 19, 2009 at 11:16 AM, alessandro terenzi <[email protected] >> > wrote: >> >>> I'd like to create a fixed background for an osg application, much like a >>> HUD but while the HUD is always on top of the scene, I need to have an image >>> always behind any 3D object. >>> >>> I tried to modify the example about HUDs by changing: >>> >>> setRenderOrder(osg::Camera::POST_RENDER); >>> >>> into this: >>> >>> setRenderOrder(osg::Camera::PRE_RENDER); >>> >>> but I guess that this is not sufficent to achive my goal, because >>> actually the background image is not displayed at all (or maybe it is >>> covered by the scene...). >>> >>> How can I create the desired effect? >>> Thanks in advance. >>> Alessandro >>> >>> _______________________________________________ >>> osg-users mailing list >>> [email protected] >>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >>> >>> >> >> _______________________________________________ >> osg-users mailing list >> [email protected] >> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org >> >> > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > >
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

