Hi Micael,

I've been stuck with this issue for a while now and I really have no idea what 
is causing it. I have a really basic scene that render just fine using the 
basic OpenGL rendering pipeline but when I enable the 
osg::Camera::FRAME_BUFFER_OBJECT tag with any osgPPU shader this is the result 
I get. http://youtu.be/k0-IGAvNy_s

I have tried to use osgViewer as the base of my application instead of SFML 
witch fixed the problem but it can't be a permanent solution for me. It appears 
that the function osgUtil::SceneView::draw() is called even when it's not 
rendering. Here are the parts of my code that could be causing the problem.

I have no idea what SFML is, and if your app works with osgViewer but doesn't with some other viewer I don't know how useful my comments will be. I've had a problem very similar to this with osgPPU myself in the past, and it was caused by the camera's compute near far mode being set to auto compute. Basically the problem was that when the cull visitor traversed the processor, it would try to include it in the near-far computation, which would then compute wrong values and clip out osgPPU's final render quad.

In osgPPU's examples, the camera's near-far computation is disabled, but I couldn't do this in our projects because we rely on this feature. The solution I found was to override osgPPU::Processor's traverse() method disabling near-far computation for its children.

    class OurProcessor : public osgPPU::Processor
    {
    public:
        OurProcessor() : osgPPU::Processor() {}

        virtual void traverse(osg::NodeVisitor& nv)
        {
            osg::CullSettings::ComputeNearFarMode oldComputeNearFarMode;
            osgUtil::CullVisitor* cv =
                dynamic_cast<osgUtil::CullVisitor*>(&nv);

            if (cv)
            {
                oldComputeNearFarMode = cv->getComputeNearFarMode();
                cv->setComputeNearFarMode(
                    osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR);
            }

            osgPPU::Processor::traverse(nv);

            if (cv)
            {
                cv->setComputeNearFarMode(oldComputeNearFarMode);
            }
        }
    };


However, as I said I know nothing about SFML. If in osgViewer you forced the viewer camera's near-far computation off but not in SFML, then you might be seeing this kind of problem, but if not then I don't know what else could be going on...

Hope this helps,

J-S
--
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.g...@cm-labs.com
                               http://www.cm-labs.com/
                    http://whitestar02.dyndns-web.com/
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to