Hi, Alexej

Try this callback as cull callback on your camera, call reset() after you 
change attachments

class CameraResetCallback: public osg::NodeCallback
{
public:
        CameraResetCallback():m_resetFlag(true){}
        void operator() (osg::Node* node, osg::NodeVisitor* nv)
        {
                if (m_resetFlag)
                {
                        osg::Camera* fboCam = dynamic_cast<osg::Camera*>( node 
);
                        osgUtil::CullVisitor* cv = 
dynamic_cast<osgUtil::CullVisitor*>(nv);

                        if ( fboCam && cv)
                        {
                                
cv->getCurrentRenderBin()->getStage()->setFrameBufferObject(NULL);
                                
cv->getCurrentRenderBin()->getStage()->setCameraRequiresSetUp( true );
                                m_resetFlag = false;
                        }


                }
                traverse(node,nv);
        }
        void reset(){m_resetFlag = true;}
private:
        bool m_resetFlag;
};

11.10.2011, 18:02, "Alexej Fink" <[email protected]>:
> Hi folks,
>
> additional observation:
>
> In case, where for each frame in the update-callback the color-buffer 
> attachment is bound to new Image instance, and all outcoming pictures are all 
> gray, except the first one -- I now store the reference to the initial 
> color-buffer bound image, and write it's content together with the newly 
> created per frame images. The per frame created and bound images are still 
> gray, but the initial image receives the frame content instead. So the unbind 
> and bind to new image in the update callback seems not to work, here:
>
> Code:
> // in update callback
> cam->detach( osg::Camera::COLOR_BUFFER);
> cam->attach( osg::Camera::COLOR_BUFFER, mImage.get());
>
> Only the first bound image receives the frame content, independent of 
> rebinding the color_buffer.
>
> Can anyone help with some idea, what is goin wrong?
>
> Cheers,
> Alexej
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=43314#43314
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to