How to reference TGLViewer

Hi,

I am creating a model using the TGeoManager functions and viewing them with the OpenGL viewer, i.e. top->Draw(“ogl”). The problem I am having is that I am unable to figure out how to reference the TGLViewer (TGLSAViewer?) to pass as the first argument in the TGLAnnotation command. The TGLSAViewer has annotations available in the gui, but I would like to put them in a script.

The only example I found of TGLAnnotation being used was in $ROOTSYS/tutorials/eve/annotation.C, but using TEve makes it seem like I’d need to change the way every object is drawn in my code.

Any suggestions on referencing the viewer? TGLAnnotation needs an object of type TGLViewerBase for the first argument, and that is where I am stuck.

Thanks,

Zack

Hi Zack,

You can call gPad->GetViewer3D() and cast this to TGLViewer (or TGLSAViewer).

You can also call Draw() without “ogl” (or just add the object into pad’s list of primitives, if you create pad yourself) and then pass the pad* to TGLSAViewer constructor.

I’m not sure what you are aiming for … but EVE is good :wink: Have you seen the demos dealing with geometry using TEveGeoTopNode?

Cheers,
Matevz

I was so close! I think at one point I had done what you suggested but it didn’t work (seg fault) because I hadn’t done top->Draw(“ogl”) yet and hence the viewer that was being referenced didn’t yet exist. I moved the Draw command up earlier in the script and it worked nicely. :slight_smile:

Now I can also reference the camera commands in the viewer and spruce up my model. Thanks for the tips - examples on the GL classes seem hard to find. I also glanced at the TEveGeoTopNode tutorial and may make use of it in the future.

Nice mustache.

Zack