Dear all,
I was still trying to fetch the left-eye and right-eye images in the stereo
mode.
code as follow:
class: class CaptureDrawCallBack : public osg::Camera::DrawCallback
the key overload function:
void operator()(osg::RenderInfo &renderInfo) const
{
// capture , bool ,when I want to capture the screen,key press event will
switch it to be true.
if(capture)
{
// osg::ref_ptr<osg::Image> _imageL, _imageR
_imageL->allocateImage(scwidth,scheight,1,GL_RGBA,GL_UNSIGNED_BYTE);
_imageR->allocateImage(scwidth,scheight,1,GL_RGBA,GL_UNSIGNED_BYTE);
renderInfo.getCurrentCamera()->setReadBuffer(GL_BACK_LEFT);
_imageL->readPixels(0,0,scwidth,scheight,GL_RGBA,GL_UNSIGNED_BYTE);
osgDB::writeImageFile(*(_imageL.get()),fileNmaeL);
renderInfo.getCurrentCamera()->setReadBuffer(GL_BACK_RIGHT);
_imageR->readPixels(0,0,scwidth,scheight,GL_RGBA,GL_UNSIGNED_BYTE);
osgDB::writeImageFile(*(_imageR.get()),fileNmaeR);
capture = false;
}
}
and in the main viewer's camera:
viewer->getCamera()->setPostDrawCallback(new CaptureDrawCallBack());
the program runs successfully(thoug no high effect ,just to test the
function), with a quadro card supproted, I can see the stero effect.
but when I capture the screen :
the two images saved by the above operation are the same, not as expected: a
left-eye iamge, a right-eye image.
can some one give me some suggestions?
online waiting.
thanks.
whu
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org