Hi all,
I have a class overloading an osg::Group. I overload the "traverse" method
to apply 3 shaders passes to draw the scene
create shader1_stateset
create shader2_stateset
create shader3_stateset
void traverse(osg::NodeVisitor& nv)
{
if(nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR))
{
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
cv->pushStateSet(shader1_stateset);
osg::Group::traverse(nv);
cv->popStateSet();
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
cv->pushStateSet(shader2_stateset);
osg::Group::traverse(nv);
cv->popStateSet();
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
cv->pushStateSet(shader3_stateset);
osg::Group::traverse(nv);
cv->popStateSet();
}
}
This algorithm works, but now I want to do Render To Texture in floatting
point. I tried retrieve the camera and set the targetImplementation with a
FBO and attach a floatting texture, but the texture keep empty at the end.
How can I do?
Someone have an idea?
void traverse(osg::NodeVisitor& nv)
{
if(nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR))
{
if(nv.getVisitorType()==osg::NodeVisitor::CULL_VISITOR))
{
if
(cv->getRenderStage()->getCamera()->getRenderTargetImplementation() !=
osg::Camera::FRAME_BUFFER_OBJECT)
{
cv->getRenderStage()->getCamera()->setRenderTargetImplementation(osg::Camera::FRAME_BUFFER_OBJECT);
cv->getRenderStage()->getCamera()->attach(osg::Camera::COLOR_BUFFER,m_hdrTexture);
}
...
....
}
}
}
Thanks
bnua
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org