Hi Alex,

I do a similar thing with the HelpHandler. I subclassed the
HelpHandler like below.
I then instantiate it and add it to the Viewer (and a osgWidget
menuitem). Then I call initialize on it *before* viewer.run() but
*after* viewer.realize()

hope this helps
Mattias

//! Simple wrapper of the osgViewer::HelpHandler to let me initialize
it before first invocation of it's \c handle()
struct MyHelpHandler : public osgViewer::HelpHandler
{
    MyHelpHandler(osg::ApplicationUsage* au) : osgViewer::HelpHandler(au) {};
    void initialize(osgViewer::ViewerBase* viewer)
    {
        if (!_initialized && viewer)
        {
            setUpHUDCamera(viewer);
            setUpScene(viewer);
            if(_camera.valid())
            {
                _camera->setNodeMask(0);
                _helpEnabled = false;
            }
        }
    }
};


On 10/15/08, Alexander Löffler <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am trying to display on-screen statistics as provided by the
> osgViewer::StatsHandler without the need for doing this via handling the key
> presses first. That is, I want to add a command line options to my
> application
> to either display statistics just as frame rate, full stats, or not at all.
>
> Is there an easy way to do that with the available StatsHandler? I tried
> subclassing from the handler with the option to set the StatsType initially.
> Currently without success, as there seem to be lots of dependencies of what
> parts of OSG have to be set up before collecting of stats is actually
> possible.
> For example, some cameras seem not yet to be set up when I instantiate my
> handler, collecting GPU stats is disabled in my HUD, etc..
>
> Has anyone ever done something similar before?
>
> Thanks a lot in advance,
> Alex.
> _______________________________________________
> 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

Reply via email to