How to create an embedded openGL viewer and draw in it

Dear Matevz,

[quote=“matevz”]Hi Jing,
What are you actually trying to do, also on a larger scale?
[/quote]
Thank you for asking. I am building up an event display for the XMASS dark matter experiment. The photo cathodes of inner PMT array are grouped as shown in the attached picture. I would like to assign different colors to the photo cathodes based on the energies recorded by the PMTs. For online event display, I don’t need to show tracks and hits (I may need to work on this later for reconstructed events). Changing colors of some nodes and redraw the viewer is all I wanna to.

I was trying to follow the example, tutorials/geom/runplugin.C. It didn’t work out very well because

  1. if all nodes share a single volume, I cannot build up a stand alone program due to the reason mentioned in this post: TGeoIteratorPlugin::fIterator is private

  2. I then initialized one volume for each node so that I can change the color of each node without affecting others by using

gGeoManager->cd("/.../.../...");
gGeoManager->GetCurrentNode()->GetVolume()->SetLineColor(kBlue); 

. But the viewer won’t be redrawn unless I click on it. I had used gGeoManager->GetGeomPainter()->ModifiedPad() after I changed colors. It didn’t work for some reason (It does work in runplugin.C example).

  1. I would like to show openGL viewer only. I set “Viewer3D.DefaultDrawOption: ogl” in my .rootrc. But an empty normal canvas will pop up together with the openGL viewer. This is quit confusing for a user of this event display. And this program would be run in different machines. I cannot change .rootrc in all of them. This is why I start to think of having an embedded openGL viewer and draw geometries in it.

Exactly. I didn’t start with EVE because I thought my application was very simple, I didn’t need something big as EVE. After having so many issues on building up my own event display, I turned back to EVE. That’s why I posted this How to get a TEveElement from EVE in command line the other day.

I guess this is the reason for my problem 3? A pad is created before a GL scene.

I guess this is the reason for my problem 2?

great. But where can I get the pointer to TGLViewer?

[quote=“matevz”]
I strongly suggest to use existing Eve interfaces. These can also be extended or made more flexible if needed.

Best,
Matevz[/quote]

If my simple solution won’t work out, I would love to use EVE. I guess I can at first import my geometry to EVE by following tutorials/eve/assembly.C and then use your trick How to get a TEveElement from EVE in command line to change colors. But how can I add buttons and menus in EVE main window to step through events (e.g. previous, next events)?

Sorry for such a long post.

Cheers, Jing