Hi, Koduri > ImageDB[imgIdx]=sCapImage; Seems like you storing pointer to same image in all array elements, you should use either ImageDB[imgIdx]= new osg::Image(sCapImage, osg::CopyOp::DEEP_COPY_ALL); or ImageDB[imgIdx]= static_cast<osg::Image*>(sCapImage->clone(osg::CopyOp::DEEP_COPY_ALL));
Cheers, Sergey. 13.06.2012, 17:49, "Koduri Lakshmi" <[email protected]>: > Hi, > > I am doing a program to capture the screen of renderer model. I did it by > setting graphic context. Now I am getting image. > > Now I am setting all these images to an array and then finally saving to the > disk. But I am getting only the last image. Here is the code > > Code: > sCapImage->scaleImage(320,240,1); //sCapImage is the image contains the > screen data and it is declared as osg::ref_ptr<osg::Image> sCapImage; > > ImageDB[imgIdx] = new osg::Image; > //ImageDB is declared as osg::ref_ptr<osg::Image> ImageDB[100]; > > ImageDB[imgIdx]->allocateImage(sCapImage->s(), sCapImage->t(), 1, GL_RGB, > GL_UNSIGNED_BYTE); > > ImageDB[imgIdx]=sCapImage; > for(int i=1;i<99;i++) > { > char tmp[10]; > itoa(i,tmp,10); > char pngName[30]; > strcpy(pngName,"C:\\Test\\"); > strcat(pngName,tmp); > strcat(pngName,".png"); > std::cout<<pngName<<std::endl; > osgDB::writeImageFile(*(ImageDB[i]),pngName); > } > > osg::ref_ptr<osg::Image> ImageDB[200]; is the ImageDB > osg::ref_ptr<osg::Image> sCapImage; are the declarations. > > are the declarations . > > Can you please help me where am i doing mistake > > ... > > Thank you! > > Cheers, > Koduri > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=48277#48277 > > _______________________________________________ > 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

