Producing a gif output from TVirtualViewer3D or TGLSAViewer

Hello Root Experts,

I wonder which is the professional command-line way of storing the output of TVirtualViewer3D on a gif or jpg or similar. The viewer I am concerned with is the one I get when displaying a TGeoManager’s geometry - I guess it is TGLSAViewer. It allows me to produce a gif via menu “File” - “Save” etc. I smartly checked the source code and found out that the member function I am after is indeed there, called TGLSAViewer::SavePicture, except, guess what, it is private. So what should one call instead?

Many thanks and best regards
Dariusz Miskowiec

Yes, you are right. I will check this and let you know when I found the solution.

After having put TGLSAViewer::SavePicture() public can do:

root [1] TGLSAViewer *gl = (TGLSAViewer *)gPad->GetViewer3D()
root [2] gl->SavePicture(“gl.gif”);

“gl.gif” is properly generated from the current GLViewer. Is that what you are looking for ?
Let me know. I’ll commit the change in CVS if that’s what you need.

I have done the modification. TGLSAViewer::SavePicture is now a public method. Therefore it is now possible to generate gif files of the GL-Viewer from the command line

root [1] TGLSAViewer *glv = (TGLSAViewer *)gPad->GetViewer3D();
root [2] glv->SavePicture(“gl.gif”);

TGLSAViewer::SavePicture has also been modified to allow to generate animated gif files. Example:

root [1] TGLSAViewer *glv = (TGLSAViewer *)gPad->GetViewer3D();
root [2] glv->SavePicture(“gl.gif+”);
root [3] glv->SavePicture(“gl.gif+”);
root [4] glv->SavePicture(“gl.gif+”);

Between each call to glv->SavePicture(“gl.gif+”), the GL-Viewer display has been modified. Then gl.gif is an amination build from the various images displayed in the GL-Viewer.

Thanks a lot for making public (=publishing?) SavePicture. This was what I needed.

Best regards