Hi Duan, You'll need to add the callback a camera attached to the specific window you want to capture. Each osg::GraphicsContext (that is the base class of GraphicsWindow) has a getCameras() method for getting the list of cameras attached to it.
Robert. On Mon, Dec 27, 2010 at 3:01 PM, Duan Linghao <[email protected]> wrote: > Hi, > How can I get a screenshot from the specified window? > I have a multi-dialog app created by MFC.And I use CompositeViewer to show a > model in two dialog,the compositeviewer contains two viewers,which correspond > to the two dialogs separately.My code is: > > Code: > > viewer1->getCamera()->setPostDrawCallback(new > CaptuerDrawCallBack(image_c.get())); > viewer2->getCamera()->setPostDrawCallback(new > CaptuerDrawCallBack(image_c.get())); > c_viewer->frame(); > > > struct CaptuerDrawCallBack:public osg::Camera::DrawCallback > { > CaptuerDrawCallBack(osg::ref_ptr<osg::Image>image) > { > _image=image; > } > ~CaptuerDrawCallBack(){} > virtual void operator()(const osg::Camera& camera)const > { > _image->allocateImage(720,576,1,GL_RGBA,GL_UNSIGNED_BYTE); > _image->readPixels(0,0,720,576,GL_RGBA,GL_UNSIGNED_BYTE); > pData=_image->data(); > } > osg::ref_ptr<osg::Image>_image; > > > > Where c_frame is a CompositeViewer.It only can get a screenshot from the > viewer2.How can I get a screenshot from the two windows separately? > > Thank you! > > Cheers, > Duan > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=35181#35181 > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

