TGLViewer SavePicture not exporting .eps and .pdf properly

Please read tips for efficient and successful posting and posting code

ROOT Version: 6.20/04
Platform: x86_64-centos7-gcc9-opt (on a CernVM-FS server)
Compiler: Not Provided

Hi folks,

I’m trying to export what’s displayed on the “ROOT’s GL viewer” window with the SavePicture function of the TGLViewer class.

I ran the following commands within a root session to export pictures with different formats.

TGLViewer * v = (TGLViewer *)gPad->GetViewer3D();

Exporting as png (or gif, gif+) all worked perfect, but pdf is somewhat broken as shown below. Exporting as eps is even worse as it crashed and output only an empty file. I know that I can avoid pdf by scaling up png images but I wish to understand why are pdf and eps broken in my case. Could anyone shed some light on this problem? I really appreciate it!

viewer.pdf (147.6 KB)

Hello @Patrick_Wu,

This seems like a bug. @bellenot, @linev, have someone reported this before? I quickly searched GH issues and there seems to be nothing.

@Patrick_Wu, could you please send a small reproducer of your problem?


1 Like

Hi, thanks a lot for replying!

This is actually the first time I use TGLViewer…so I basically looked up everything first in the Class Reference and and found SavePicture function supports pdf format. This link ROOT: TGLViewer Class Reference should be able to bring you to the description of SavePicture. However, it warns me that ‘eps’ and ‘pdf’ do not fully support transparency and texturing. Perhaps this is the cause?


Thanks for replying. I’ve found the solution…

The pdf exporting is actually working as expected. The problem is caused by the semitransparent box (alpha value set to really low so you can barely see it) around the 3D object. At current stage, SavePicture with pdf format can not handle semitransparent object properly. That’s why it was rendered that way. I have to change the visualization attribute to transparent. And I can also export as eps file which turns out to be much better than pdf after experimenting.

I am glad to hear that you found the solution! Thanks for posting it here; I am sure other users will benefit from this.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.