Hi,
I am actually trying to find another way to create a screenshot since using the
osgscreencapture (pbuffer) doesnt work properly.
I tried to do a simple DrawCallBack where I will call readPixels and write the
image on the disk, the viewer is setupInWindo of the size 1024x1024 , and so
the size of the imag eis 1024x1024 but the 10 top lines of the image is garbage
, and I could find where this problem come from... , One thing interesting is
that by setUp the viewer in single full screen mode, the screenshot I get is
correct .
here is the Simple DrawCallBack :
Code:
class CCameraPostDrawCallback: public osg::Camera::DrawCallback {
public:
CCameraPostDrawCallback() { }
void operator () (const osg::Camera& cam) const {
//take a picture of the scene
osg::ref_ptr<osg::Image> screenShot = new osg::Image;
screenShot->readPixels(0,0 , 1024, 1024, GL_RGB, GL_UNSIGNED_BYTE);
osgDB::writeImageFile(*screenShot, "E:test.jpg");
}
};
then to call it I do :
Code:
getCamera()->setFinalDrawCallback(new CCameraPostDrawCallback);
getCamera()->setRenderOrder( osg::Camera::POST_RENDER );
frame();
here is the result :
[Image:
http://lh3.ggpht.com/_1P5kZ9Ht-hA/TCVdmsSLvyI/AAAAAAAABD4/_V3yijX62BQ/s512/test.jpg
]
If any ideas ...
thanks
[/img]
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=29418#29418
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org