Is Open GL in batch mode?

Dear ROOTers,

I would like to print some geometries with openGL in batch mode. I found that it is not possible in a previous thread

Is there any workaround?

Thank you for your time.

Best
atd


ROOT Version: 6.26
Platform: CC8
Compiler: 8.5


You are using the OpenGl viewer from a macro ?
Can you post a small script showing what you are doing ?
May be @agheata knows a way.

Hi,

A file with some geometry is provided, and the following lines open it, plot the geometry and save a screenshot. It works when the actual geometry is displayed but it crashes with a segmentation fault when drawing if Batch mode is enabled.

TFile *_file0 = TFile::Open("my_geometry.root");
TGeoManager* mygeo_man = (TGeoManager*)_file0->Get("default");
auto myworld = mygeo_man->FindVolumeFast("world_volume");
myworld->Draw("ogl");
TGLViewer * v = (TGLViewer *)gPad->GetViewer3D();
v->SavePicture("a_geometry.jpg");

Thank you for your time.

Best,
atd

I see now. OpenGL is meant to display 3D scenes on the screen there is no batch mode.

So, there is no way to save a screenshot such 3D scenes without displaying them?

Maybe using framebuffer (Framebuffer object - Wikipedia). @matevz might know better

it sounds promising! Can you provide a hint of a potential next step?

Let’s wait for @matevz

Hi,

In principle, geometry drawing in batch mode can be done with web-based painter.
While web browsers in headless (batch) mode supporting WebGL functionality.
Unfortunately, I not yet implement this :frowning:

Probably I will manage to provide such functionality in next 6.28 release.

Regards,
Sergey

2 Likes

Hi

Juraj Smiesko found a workaround using xvfw python module

import ROOT

from xvfbwrapper import Xvfb

vdisplay = Xvfb()
vdisplay.start()

_file0 = ROOT.TFile("fccee_idea.root");
mygeo_man = _file0.Get("default");
myworld = mygeo_man.FindVolumeFast("world_volume");
myworld.Draw("ogl");
v = ROOT.gPad.GetViewer3D();
v.SavePicture("a_geometry.jpg");

vdisplay.stop()

Info about the module here: xvfbwrapper · PyPI

Remember to install the system package in addition to the python module

sudo apt-get install xvfb, yum install xorg-x11-server-Xvfb, etc

Best,
Alvaro.

1 Like

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