[osg-users] OSG 3.2.1 and Qt5 Widget integration

Pierre-Jean Petitprez pierre-jean.petitprez at inria.fr
Fri Mar 4 01:02:04 PST 2016


Hi Wojtek,

When using this code I get the same result as you, the StatsHandler camera doesn't display on top of the other cameras. I guess it comes from the hack that makes the main camera render last or something like that. My hack was to add the StatsHandler camera into my own scene graph so that it will be rendered in the correct order.
I've inherited from the osgViewer::Viewer and reimplemented the addEventHandler method:

Code:
void addEventHandler(osgGA::GUIEventHandler *eventHandler)
{
osgViewer::Viewer::addEventHandler(eventHandler);

osgViewer::StatsHandler *stats = dynamic_cast<osgViewer::StatsHandler*>(eventHandler);
if(stats)
{
osg::Camera* camera = stats->getCamera();
getSceneData()->asGroup()->addChild(camera);
}
}



It's ugly but at least I get the statsHandler back.
If anyone has a better solution, I'd be happy to see it.

I hope it'll work for you.
Cheers, 
Pierre-Jean


karcios wrote:
> Hi,
> 
> After changing 
> 
> Code:
> 
> void RenderStageEx::drawInner(osg::RenderInfo& renderInfo, osgUtil::RenderLeaf*& previous, bool& doCopyTexture)
> 
> 
> 
> 
> I lost 's' key  - stats handler stopped working,
> looks like problem with another camera.
> 
> Any help?
> 
> Cheers,
> Wojtek


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








More information about the osg-users mailing list