Hi Aurelien,

I ran into a case where I needed access to the CullVisitor, RenderStage,
and FBO objects from within the draw method of a drawable. I usually prefer
solutions that don't require changes to the core OSG, so my solution is
admittedly hacky, but it works fine for my use case.

I created a custom StateAttribute class that stores a pointer to the
CullVisitor/RenderStage objects. I attach a cull callback to my Camera that
performs a push/pop of the state attribute to the cull visitor stateset
stack.

Within the draw method I can now use state.getLastAppliedAttribute() to get
access to my custom state attribute which contains the render stage. This
allows me to access the current FBO and multisample resolve FBO.

In the future, it would be nice to get a pointer to the current RenderStage
object from the osg::State. However, since RenderStage resides in the
osgUtil library, this would cause a circular dependency. You guys were
discussing providing access to just the FBO, but this would not have helped
in my case, because I also needed access to the multisample resolve FBO as
well. If you do come up with a solution I hope it will address this use
case as well.

Cheers,
Farshid



On Tue, Jul 23, 2013 at 6:54 AM, Aurelien Albert <
[email protected]> wrote:

> Hi Robert,
>
> I'm still looking for a solution on this issue. For now, we  have :
>
> 1/ My original submission. Works fine for me, "simple feature" : just
> track the fbo id, but clearly not in the "OSG code spirit". Looks like a
> big hack.
>
> 2/ Use "haveAppliedAttribute" with a type member. Much more in the "OSG
> code spirit", but looks really hacky to use.
>
> 3/ Do nothing and look for a better solution.
>
> My preference goes to 1/ (of course !) but I really understand that's a
> bad idea for the whole community.
>
> Any thoughts ?
>
> Thank you!
>
> Cheers,
> Aurelien
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=55369#55369
>
>
>
>
>
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to