Hi,

I have a postdraw callback attached to the viewer camera which looks for any 
shaders with error logs and flags them for removal.  I have a separate callback 
that then iterates those flags and removes them accordingly.

However, to make the shaders accessible to my postdraw callback, I had to keep 
references to them in the draw callback instance.  It worked fine, but it's a 
bit of a pain to manage.  So, I'm looking for a little better way of doing 
that.  

My best thought at the moment is:

1.  Create a postdrawNodeVisitor with 'apply (osg::Program&)' as an overload.  
All post-draw shader manipulation is encapsulated there.

2.  Add my camera as a child of the scenegraph's root node (which isn't 
rendered by the camera).

3.  In my postdraw callback, call camera->getParent( 0 )->accept ( 
postdrawNodeVisitor );

The solution appears to be good enough - I don't need to traverse the graph 
every time to do shader maintenance (only when they get added or removed from 
the graph), so the postdraw would trigger a traversal only when necessary.

However, it just seems a bit odd to add the camera as a child to the root node 
to get the job done.  Is there some other linkage to the scene graph available 
from a camera's post draw?  

Thanks,

Joel

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





_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to