Using TGLWidget

Is there any tutorial or example code on how to use TGLWidget and execute OpenGL commands in it?

I do not think we have example for that. It is mainly used inside the Eve package. Look at the Eve code.

Hi,

TGLWidget inherits from TGFrame … it basically ties together ROOT GUI with GL context creation. You can sub class it but you have to do everything by yourself then, low level GL initialization as well as GUI event handling.

TGLWidget is used from TGLViewer for drawing into it and TGLEventHandler handles the user events. TGLViewers and Scenes are ROOT’s version of a scene-graph support … and TEve is higher level stuff for displaying objects that are standard in HEP, like detectors, tracks, calorimeters + projected views and user interaction management. See the references on top of those pages:
root.cern.ch/root/htmldoc/GRAF3D_GL_Index.html
root.cern.ch/root/htmldoc/GRAF3D_EVE_Index.html

What are you trying to do? :slight_smile:

Cheers,
Matevz

Oh, just saw your other post about GLFW :slight_smile: If you’re happy with what you have there … have you tried just using it as it is? Or you want to integrate it with ROOT GUI?

If you want, I can help you splice TGLEventHandler into TGLEventHandlerBase so you can get rid of the TGLViewer entanglement.

Cheers,
\m