Hi David, On 2/15/07, David Spilling <[EMAIL PROTECTED]> wrote:
I have a nodekit which contains drawables, and shaders. How can I detect within the nodekit, whether the parent application is rendering the drawable to, for example, a normal RGBA8 window color buffer, or a RGB16F FBO, etc. I need to do this because it will influence the shaders that the nodekit chooses to use.
osg::State does have a pointer to the current GraphisContext though which might get you some of the way to finding out the setup of the graphics window itself. Unfortunately osg::State doesn't present track whether FBO's are active or not, so from within an osg::Drawable::drawImplementation() you won't know. RenderStage::drawInner is where the FBO is applied, but its applied via _fbo->apply(state); rather than state.applyAttribute(_fbo). If it did th later then you'd be able to get the list of current active attributes from osg::State. state.applyAttibute does lazy state updating though, so there is chance that it won't apply the FBO. Perhaps a statehaveAppliedAttribute would do the trick. So while there isn't a solution immediately to hand - nobodies asked for such a feature before, but it should be possible to wire it up without too much problem, modifying RenderStage::drawInner is probably the place to tweak. Feel free to experiment. Robert. _______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
