Thanks for the answer, Dan. The problem with the GrabForeground was exactly the one you mentioned: the created image was 1x1 pixel big.
I tried to change the code to the FileGrabForeground, like you suggested And that worked pretty fine. The problem is that the images are saved remotely, while I'd like to have them on the client machine. Is there a way to grab the remote image information and then save them back on the client side? (via for example the grabforeground::getImage function) thanks for the help E. > -----Messaggio originale----- > Da: [EMAIL PROTECTED] [mailto:opensg-users- > [EMAIL PROTECTED] Per conto di Daniel Sperka > Inviato: mercoledì 22 novembre 2006 20.13 > A: [email protected] > Oggetto: Re: [Opensg-users] cluster and image grab foregrond > > Enrico - > > is the image really empty, or a small size like 2x2? > > If you're trying to save the images to files, use OSGGrabFileForeground > instead of just plain OSGGrabForeground : > > > FileGrabForegroundPtr fgp = FileGrabForeground::create(); > string s; > s.assign("%04d.png"); > > beginEditCP(fgp); > fgp->setName(s); > fgp->setActive(true); > fgp->setIncrement(true); > fgp->setAutoResize(true); > endEditCP(fgp); > > f_worldP->getViewport()->getMFForegrounds()->push_back(fgp); > _SLOG(f_pslog, render::util::sINFO, "Grabbing frames and saving > to file(s) named " + fgp->getName()); > _SLOG(f_pslog, render::util::sINFO, "Expect slow performance!!!"); > > The FileGrabForeground automatically saves to files named, in this > example, 0000.png, 0001.png, etc. This assumes that you have compiled > png support into your OSG libs (jpg extension allowed, also, if you > compiled in jpg support). > > Nice thing about FileGrabForeground is that it automatically allocates > the Image for you. The 'setAutoResize(true)' call automatically resizes > the images saved to the window size. > > **Caution** this saves one image per frame..... Don't run a long app at > high resolution unless you have a lot of time and disk space! > > One final word of caution. If running XWindows (not sure about Windows) > you have to ensure that the window's resize() function is called once > prior to rendering. If you're running fullscreen, that might not happen > if you use the CONFIGURE_NOTIFY event to resize the window (e.g. by > calling window->resize(w, h) from that event in your x event loop), > because at fullscreen on XWindows the CONFIGURE_NOTIFY event does not > get called! Its safe to just call window->resize(w, h) with the correct > values - all it does is save those values in the Window object for later > retrieval. > > > > Dan > > > > > > > > Enrico wrote: > > Hi opensg users, > > > > > > > > i am working to a cluster/server application. > > > > I would like to take screenshots of what is being rendered > > > > On the remote windows, > > > > so I attached to the viewport a GrabForegroundPtr. > > > > > > > > The problem is that when I try to save the grabbed image, > > > > it is empty. > > > > > > > > fgndImage->setActive(true); > > > > m_pMgr->redraw(); // render pass > > > > fgndImage->setActive(false); > > > > > > > > // get foreground image > > > > beginEditCP(fgndImage, GrabForeground::ImageFieldMask); > > > > ImagePtr img = fgndImage->getImage(); > > > > endEditCP(fgndImage, GrabForeground::ImageFieldMask); > > > > > > > > //get pixel data > > > > beginEditCP(fgndImage, Image::PixelFieldMask); > > > > UInt8 *imageData = img->getData(); > > > > int width = img->getWidth(); > > > > int height = img->getHeight(); > > > > endEditCP(fgndImage, Image::PixelFieldMask); > > > > > > > > Does anyone has any clue? > > > > > > > > Thanks > > > > E. > > > > > > > > ------------------------------------------------------------------------ > > > > ------------------------------------------------------------------------ > - > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > > opinions on IT & business topics through brief surveys - and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ------------------------------------------------------------------------ > > > > _______________________________________________ > > Opensg-users mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/opensg-users > > > > -- > Daniel J. Sperka, Ph. D. > UC Davis Center for Neuroscience > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Opensg-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/opensg-users ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Opensg-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/opensg-users
