RE: [ROOT] ROOT and OpenGL

From: Valeri Fine (fine@bnl.gov)
Date: Mon Sep 09 2002 - 17:08:15 MEST


Hello Denis,
"Open Inventor" viewer is a concrete implementation of 
TPadView3D class:
http://root.cern.ch/root/htmldoc/TPadView3D.html

In fact there are two different implementations one for UNIX (written by
Fons) and another one for Windows (Win32).

To get any 3D view of the ROOT 3D objects one needs two steps:

   1. Draw the desired object to ROOT TPad via TObject::Draw() method
(as usually)

   2. Call gPad->x3d("OPENGL"); method
      (It is the method that is called via TCanvas "OpenGL view" menu)
(see:  http://root.cern.ch/root/htmldoc/src/TPad.cxx.html#TPad:x3d  

This assumes the "Open Inventor" implementation for TPadView3D class was
built and loaded properly (this is what the "$ROOTSYS/configure" should
care about). Check your "configure log" to see whether "Open Inventor"
view was selected.

                     Hope this helps, Valeri




> -----Original Message-----
> From: dbertini@lxg0402.gsi.de [mailto:dbertini@lxg0402.gsi.de] On
Behalf
> Of Denis Bertini
> Sent: Monday, September 09, 2002 5:41 AM
> To: Valeri Fine; roottalk@pcroot.cern.ch
> Subject: Re: [ROOT] ROOT and OpenGL
> 
> Hi Valeri,
> I would like to display an Open Inventor scene using the  ROOT "Open
> Inventor"
>  viewer.
>  Right now i did not find the way to do this.
>  Do you know where i can find some test example how to do this?
> 
> best
> regards,
> 
> Denis
> 
> 
> 
> 
> 
> Valeri Fine wrote:
> 
> > Hello Glen,
> >
> > ROOT TGLViewer interface was designed to draw 3D object built from
the
> > instances of TShape class
> > The 3D GL window is created by "OpenGL" implementation of
> > http://root.cern.ch/root/htmldoc/TGLViewerImp.html
> > class.
> > from the list of the methods of that class one may arrive at the
> conclusion
> > the only useful method there is
> > virtual void SetDrawList(UInt_t list).
> > That allow you to generate some OpenGL list within your code and
pass it
> to
> > the TGLViewerImp class to be rendered.
> >
> > I'd like to stop here to repeat this class was designed to render
ROOT
> 3D
> > objects.
> >
> > This means to get OpenGL view of some ROOT object one should
> >
> >    1. Create some instances of the ROOT 3d classes
> >    2. Apply the method TObject::Draw. As result the pointer to the
> object is
> > included
> >        into the list of the objects of the current TPad object
> >    3. Call method TPad::x3d("OPENGL")  as result the instance of the
> current
> > TPad loads
> >        ROOT GL share library, creates an instance of the TGLViewer
and
> > passes it the pointer
> >        to the object to be rendered.
> >
> > This schema looks simple for the ROOT class users  because the only
step
> > he/she needs to perform is the step #1.
> > However it may cause extra problems just one wants to use ROOT GL
viewer
> >
> > At the moment ROOT distribution provides two concrete implementation
of
> that
> > viewer, namely
> > "plain GL viewer" and "Open Inventor" viewer. The later one is a
good
> > example since it does allow to render just two kind of GL object,
ROOT
> > generated and non-ROOT generated on one screen. This may provide you
> some
> > clues.
> > See some details:
> http://www.atsweb.neu.edu/hepvis01/Site/Talks/Talk010.pdf
> >
> > However if you are not going to render ROOT and non-ROOT 3D objects
on
> one
> > screen the  ROOT solution has no advantage against of any other
viewer
> one
> > can find around.
> >
> > For example http://doc.trolltech.com/3.0/qglwidget.html  and
> > http://www.qglviewer.de/
> > It is my intention to use these classes to provide Qt-based
> implementation
> > of TGLViewer class
> > for Qt-based ROOT
http://www.usatlas.bnl.gov/~fine/QtRootDownload.html
> > This may simplify your task.
> > However this needs some time and any assistance will be appreciated.
> >
> >   My best regards,
> >                                            Valeri
> >
> > > Hi,
> > >
> > > I would like use to OpenGL commands within the ROOT framework.
Since
> ROOT
> > > uses OpenGL for 3D visualization, I believe this should be
possible.
> My
> > > goal is to create an OpenGL window and render objects with
textures,
> > > transparencies, etc., using gl* commands.  Is this possible using
the
> ROOT
> > > OpenGL window?  If so, I would greatly appreciate pointers on how
to
> get
> > > started.  If not, are there any suggestions on how to use the
advanced
> > > features of OpenGL within ROOT?
> >
> > > Thanks,
> > >
> > > Glen
> > >



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:09 MET