Hello Simon,

Second, I tried some times ago to do an offscreen rendering but If you know an easy way in osg to do it I'm interested (I think there are ways based on osg::Camera::DrawCallBack).

There is now (since OSG 2.6) an osgViewer::ScreenCaptureHandler which you can use. Unfortunately it only responds to key presses right now, but you can subclass it like this to get it to capture programmatically:

    class OurScreenCaptureHandler :
        public osgViewer::ScreenCaptureHandler
    {
    public:
        OurScreenCaptureHandler(CaptureOperation* defaultOperation = 0)
           : osgViewer::ScreenCaptureHandler(defaultOperation)
        {
        }

        /** Capture the given viewer's views on the next frame. */
        virtual void captureNextFrame(osgViewer::ViewerBase& viewer)
        {
            addCallbackToViewer(viewer);
        }
    };

Then in your frame loop, you can just call

    screenCaptureHandler->captureNextFrame(viewer);

(note: I'll be sending a new version of ScreenCaptureHandler which includes this method soon, I had to do it for our framework recently, so it will probably be included in OSG after that, no need to subclass)

Eventually, do you know some good (easy to handle) API for compressing video?

Once you have images of each frame, you can just use ffmpeg to compress the sequence into a video. See the ffmpeg man page or web page for more information.

Hope this helps,

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

Reply via email to