Hi, you can detect the current camera from the osg::RenderInfo& passed to the callback. There is a renderInfo.getCurrentCamera() method
Nick On Wed, Jul 16, 2014 at 5:22 PM, <[email protected]> wrote: > Hi all, > I'm in the process of porting SpeedDreams from PLIB to OSG and I'm > currently working on the HUD. We'd like to render the HUD onto objects > within the scene, rather than place it as an overlay on-top of the scene. > > I am using 'setDrawCallback()' to register a callback where the HUD > content can be updated prior to being drawn. Something like... > -- > class updateHUDCallback: public osg::Drawable::DrawCallback > { > virtual void drawImplementation(osg::RenderInfo& renderInfo,const > osg::Drawable* drawable) const > { > osgText::Text* text = (osgText::Text*) drawable; > > if (frame >= 999 ) frame = 100; > > // Update the text with a count > if(text){ > char ss[4]; > sprintf(ss, "%3d", frame++); > text->setText( ss ); > } > > drawable->drawImplementation(renderInfo); > } > }; > -- > > So now the problem.... > > We are planning/implementing Oculus Rift support which means that the > scene will actually be drawn twice (left and right eyes) and I want to > ensure that the HUD is only updated/changed once per 'frame'. > > The code above would put '101' in left and '102' in right, which would > freak out the user. > > Q. Is it possible to sense/detect the current camera from within the > callback? > > Our code is based around osgoculusviewer (1). > > Cheers, > Simon > > > 1. https://github.com/bjornblissing/osgoculusviewer > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > -- trajce nikolov nick
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

