Render ROOT geometry as part of an OpenGL draw() function?

Hello ROOT team,

I am interested in rendering detector geometries as part of a larger application that uses OpenGL calls in a draw() callback to render things (draw() draws one frame and is registered as a callback for a render loop to call). Is there any simple means via ROOT libraries to render a geometry, absent the accompanying user interfaces? I would be handling the interface details separately and effectively just need the polygons, etc. drawn. Processing the geometry ROOT file myself is an option, but then it strikes me, ROOT already does all that. It’d be a matter of how hard it is to access the lower-level guts vs. reinventing the wheel. Please let me know your thoughts on the matter.

Thanks,
Matthew Lockner

Hi Matthew,

This should in principle be possible … but it has never been tried :wink:

I’ll probably have to provide some new functions in TGLScene to facilitate this for you.

How big is your geometry? In principle one could pass camera information into TGLScene to do frustum culling … but if it is small enough it might make sense to just draw everything, for sake of simplicity.

I’m uber busy this week … can we get in touch after that?

Cheers,
Matevz

[quote=“matevz”]Hi Matthew,

This should in principle be possible … but it has never been tried :wink:

I’ll probably have to provide some new functions in TGLScene to facilitate this for you.

How big is your geometry? In principle one could pass camera information into TGLScene to do frustum culling … but if it is small enough it might make sense to just draw everything, for sake of simplicity.

I’m uber busy this week … can we get in touch after that?

Cheers,
Matevz[/quote]

Yes, no rush. Ideally I’m looking to have the capacity to render any detector potentially in its entirety (it’s for a virtual reality project). Certainly I wouldn’t ask to have anyone write something new in ROOT for that, though, unless it’s something that’d be generally useful to the user community.

The QtRoot “qtgl” package contains a class to convert the ROOT geometry objects into OpenGL list.
That class is used to pass the GL list to the libqglviewer.com/refManual/c … 0fcdb2d0e0

See www-conf.kek.jp/acat03/prog/presen/id0112.ppt#12 ,
slide 14 from esmane.physics.lsa.umich.edu/wl/ … o/f001.htm

The class itself has no Qt dependency. This implies that you (likely :wink: can use it elsewhere too ( nobody tried yet).
Be aware, that conversion is quite simple. It does not support the "shape operations” (yet :unamused: ) because it was implemented awhile ago. Of course, any contributions,feedbacks, bug reports are always welcome and appreciated.

Hi,

Sorry … this took a while :slight_smile: Are you still interested in doing this?
Do you have the test setup ready?

Cheers,
Matevz