Hi Petr, You can force objects to always appear by setting the StateSet::RenderBintDetails to a high bin number to make it draw after other objects, and then disable the depth test for that subgraph so it always gets drawn.
Robert. On 4 February 2014 09:52, Petr Svoboda <[email protected]> wrote: > Hi, > > I made a scene, where I detect some collisions and I want to show progress of > that collision. For example, you are poiniting at light switch and there is > circle which is filled based on time spent pointing at the switch, so the > light would turn/off after some timer period. > > That "filling cricle" is saved in images 1.png, 2.png... > Then I make a textured quad > Add quad to osg::Billboard ( I want that status bar will always be towards > camera ) > Add osg::Billboard to osg::Switch to switch between states (based on timer ) > > Here is code > > > Code: > > osg::ref_ptr<osg::Image> image1 = osgDB::readImageFile("1.png"); > osg::ref_ptr<osg::Texture2D> texture1 = new osg::Texture2D; > texture1->setImage( image1.get() ); > > osg::ref_ptr<osg::Geometry> quad1 = osg::createTexturedQuadGeometry( > osg::Vec3(-0.5f, 0.0f,-0.5f), > > osg::Vec3(1.0f,0.0f,0.0f), > > osg::Vec3(0.0f,0.0f,1.0f) ); > > osg::StateSet* ss1 = quad1->getOrCreateStateSet(); > ss1->setTextureAttributeAndModes( 0, texture1.get() ); > ss1->setMode(GL_BLEND,osg::StateAttribute::ON); > ss1->setRenderingHint(osg::StateSet::TRANSPARENT_BIN); > > > osg::ref_ptr<osg::Billboard> timer1 = new osg::Billboard; > timer1->setMode(osg::Billboard::POINT_ROT_EYE); > timer1->addDrawable( quad1.get()); > > osg::Switch* switcher = new osg::Switch; > switcher->addChild( timer1.get(),true); > > rootNode->addChild( switcher); > > > > > > This works well, but problem is that if there is some object between status > bar and camera then status bar is covered. I want to render status bar always > on top at the point of collision (intersection). > > What should I use? I tried HUD Camera, but didnt succed ( it just didnt > render anything) > > Thank you! > > Cheers > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=58138#58138 > > > > > > _______________________________________________ > 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

