Hi Guys,

I have made a few changes to osg::Camera, RenderStage and the osghud
example, which should hopefully help solve the problems you are seeing
and illustrate how to use them.  Added to include/osg/Camera we have:

        /** Set the initial draw callback for custom operations to be
done before the drawing of the camera's subgraph and pre render
stages.*/
        void setIntialDrawCallback(DrawCallback* cb) { _preDrawCallback = cb; }

        /** Set the final draw callback for custom operations to be
done after the drawing of the camera's subgraph and all of the post
render stages has been completed.*/
        void setFinalDrawCallback(DrawCallback* cb) { _finalDrawCallback = cb; }

These augment the original pre/post draw callbacks, with the original
functions being done as before.  I've added some extra doc comment to
explain the ordering of all of these so hopefully this will make
sense.  Also added is a new operator()(RenderInfo&).

        /** Draw callback for custom operations.*/
        struct DrawCallback : virtual public Object
        {
            DrawCallback() {}

            DrawCallback(const DrawCallback&,const CopyOp&) {}

            META_Object(osg,DrawCallback)

            virtual void operator () (osg::RenderInfo& renderInfo) const;

            virtual void operator () (const osg::Camera& /*camera*/) const {}
        };


The RenderInfo version is the main one now, this calls the Camera
version for backwards compatibility.  I also found a bug in
RenderInfo::popCamera() so this is now fixed.

Finally I've added a callback and event handler to the osghud example
to test out the post and final draw callbacks.  If you press 'p'
you'll get the post draw captured image written to
PostDrawCallback.png and press 'f' to get the final draw image written
to FinalDrawCallack.png.

For the purpose of snapshots you'll generally want to use the FinalDrawCallback.

An svn update will get these chagnes.

Robert.

Robert.
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to