3D animation with ROOT v5.14?


I would like to “animate” the motion of physical objects in 3D (opengl) in ROOT v5.14. For example, I would like to show the motion of a double pendulum. In other words, I want the volumes themselves to move, not just the camera.

What would be the recommended way to go about this? I thought maybe TGeoManager, but this seems to be just for “static” geometries.

Thanks for any tips or tutorials that might get me started.


You may want to try what the message
root.cern.ch/root/roottalk/roottalk06/1618.html offers.

Hello, Aaron.

I have a simple sample for you, I’m not sure if it’s what you want, but at least something:

  1. You should have CVS head (or at least the latest release) of ROOT and opportunity to recompile.
    Place modified TGLViewer.h into your $ROOTSYS/gl/inc and
    TGLViewer.cxx into $ROOTSYS/gl/src and recompile
  2. Use sample macros (animation.C or pendulum.C) - look at their code for example, how to do animation.
  3. Sometimes due to unknown reason parts (or all) of geometry disappear (not my fault) - just double click in viewer’s OpenGL drawing area.
    I’m afraid, that’s not a real solution, but it’s the simplest way to do animation now (AFAIK)

Attachments lost :frowning:
TGLViewer.cxx (72 KB)
pendulum.C (2.79 KB)
animation.C (2.72 KB)

Sorry, the header:
TGLViewer.h (15.6 KB)

Do you want something like this:

root.bnl.gov/QtRoot/pictures/Mix … Coin3D.wmv :unamused: (the file is 2.4 :exclamation: Mgb)

There is the low resolution version too.
replica3.iv.txt (163 Bytes)
replica1.iv.txt (98 Bytes)
rootgeom_coin.C (5.66 KB)

I was wondering if the new functionality that tpochep included in the hacked version of TGLViewer is now included in the latest versions of ROOT or not.

I checked the header file for TGLViewer.h for version 5.18 and I don’t see an obvious method to get direct access to a specific TGLPhysicalShape and then move it (ie animate it).

Does anybody know if this has been done or is in the works?


Yes, all this is included in 5.18
see $ROOTSYS/tutorials/gl/glparametric.C, glsurfaces.C gltf3.C, etc


Thanks. Actually, what I was looking for was if it is now possible to do the kind of animation requested in this thread (above). This animation moves the physical objects themselves, rather than just the camera view.

Timur posted a reply about how one could do it with a small hack to TGLViewer, by keeping a publicly accessible container of the TGLPhysicalShapes in TGLViewer.

Is this kind of animation possible in version 5.18 or above?

Hi Aaron,

We will investigate an let you know asap.


Hi Aaron,

Please take a look at this thread: http://root.cern.ch/phpBB2/viewtopic.php?t=6617

Cheers, Bertrand.

Great! Thanks, this definitely gets me on the road.

Just for posterity, attached is a modification of the example in this other thread mentioned above. It simultaneously moves all the pieces.

Thanks again,
renderMobile.C (5.44 KB)