openscenegraph - How can I capture an Image for post processing in OSG -
i need capture image viewer , need post processing , display on it. right more interested in first part of it. capture image viewer.
while going through osg came across screencapturehandler. not able image out of it.
i still working done in case of have other way of how can done or example screencapturehandler can share.
to capture rendered view image use custom osg::camera::drawcallback.
to capture view @ point, set drawcallback on camera, force rendering, restore null callback.
notice following code part of member function of custom viewer (that's not case):
osgviewer::view::getcamera()->setfinaldrawcallback(new viewcapturecallback(img)); osgviewer::viewer::renderingtraversals(); osgviewer::view::getcamera()->setfinaldrawcallback(null);
the viewcapturecallback uses image->readpixels() read backbuffer.
glreadbuffer( gl_back ); osg::graphicscontext* gc = renderinfo.getstate()->getgraphicscontext(); // here should process backbuffer's size , format image->readpixels(0, 0, gc->gettraits()->width, gc->gettraits()->height, pixelformat, gl_unsigned_byte);
hope helps
Comments
Post a Comment