Re: OpenGL View

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Tue Jul 27 1999 - 00:15:17 MEST


----- Original Message -----
From: Dmitri Litvintsev <litvinse@cdfsga.fnal.gov>
To: <roottalk@hpsalo.cern.ch>
Sent: 26 èþëÿ 1999 ã. 16:58
Subject: OpenGL View


>
>
> Hi Rooters,
>
> Suppose I run supplied macro 'shapes.C'. In OpenGL view:
>
> - typing 'j' which should result in drawing objects farther away,
>   actually results in their gradual disappearance (I'd say it
>   looks like shapes are being immersed in some opaque liquid,
>   like milk in this case, since the background is white)
>
> - typing 'k' gradually restores original view but at certain
>   point objects do not move any closer, while I wanted to go
>   between or inside them.
>
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-* option = 'u' *-*  Move down
*-*          'i' *-*  Move up
*-*          'h' *-*  Move right
*-*          'l' *-*  Move left
*-*          'j' *-*  Move backward
*-*          'k' *-*  Move foreward
*-*
*-*          '+' *-*  Increase speed to move
*-*          '-' *-*  Decrease speed to move
*-*
*-*          'n' *-*  turn "SMOOTH" color mode on
*-*          'm' *-*  turn "SMOOTH" color mode off
*-*
*-*          't' *-*  toggle Light model
*-*
*-*          'p' *-*  Perspective/Orthographic projection
*-*          'r' *-*  Hidden surface mode
*-*          'w' *-*  wireframe mode
*-*          'c' *-*  cull-face mode
*-*
*-*          's' *-*  increase  scale factor (clip cube borders)
*-*          'a' *-*  decrease  scale factor (clip cube borders)
*-*
*-*          'x' *-*
*-*          'y' *-*  rotate object along x,y,z axis
*-*          'z' *-*
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

> It looks like the view is restricted by some boundaries which are
> probably (guess) in the case of 'shapes.C' are defined by the
> dimensions of the 'node1' which contains all the other nodes.
>

  This is a correct observation. By default ROOT defines the parameters
of TView object "by automatic" taking in account the min/max coordinates
supplied.

The class:

http://www.star.bnl.gov/STAR/html/comp_l/root/html/examples/PadControlPanel.C.html

can be used to play with any 3D TPad objects and provides some "explanationa"

This class can be used right away with no compilation.

> Here is the question, if it is possile at all to move shapes
> so that the viewer can see them from the inside? May be someone
> has workaround?

  Yes it is possible. Just move it "forward" and try to shrink the clip cube at the
  same time with "s"/"a" command.
  Take in account the kind of projection you play with "Orthographic" / "Perspective"
  They behave very different. ! ! !
    ==================

     Projection                 Moving object             Clip cube borders
        ("p")                            ("j"/"k")                          ("a"/"s")

 Orthographic        Doesn't change scale        Scale is changed
                            of the object on the screen

 Perspective              Scale is changed          Doesn't change the scale
                                                                          of the object on the screen

  If you want to move shapes "by code" not "by hand" you may find the method

 //______________________________________________________________________________
void TPadOpenGLView::MoveModelView(char *cmd, int mlsecc)
{
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
*-*  Emulate the "chain" of the "KeyPress" events
*-*     Input:
*-*     char *cmd  - any "ASCII" character defined in
*-*                  TPadOpenGLView::MoveModelView(Char_t option, Int_t count)
*-*
*-*     int mlsecc - The total time desired to perform full "chain".
*-*                  It is assume thata single step is perform quite fast
*-*                  and mast be slow done
*-*              = 0;  No slowdown. It is painting as fast as the
*-*                    present CPU allows
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

useful as well.

> Next question - is it possible to introduce interactive
> manipulation of the shape's transparency? (I understand that
> OpenGL allows to do so).  Or at least change the view to
> hardcoded 'predefined' transparent mode by pushing some button.

   ROOT doesn't provide any "Alpha"  color attrtibute that  "blending" feature
   of OpenGL needs. Anyway this feature consumes a lot CPU been implemented.
   ( Three years ago it was too expansive )

   You may try "w" / "r" / "c" / "t" commad (see above).

  Under Windows NT all actions are reflected with the "status bar" of
  the GL viewer   window.
  I would advice to play with Windows NT to understand ROOT-GL commands.

> People use ROOT as an EventDispaly tool rather efficiently.
> OpenGL allows to get views of 'stunning beauty', to add some
> functionality to this beauty I think moving 'inside' detector
> and have the ability to look at tracks/hits through a bulk
> of the detector are the options which everyone would certainly
> appreciate.

    I agree. See: http://www.star.bnl.gov/~fine/STARImages/

   Hope this helps.
                                                  Valery



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:36 MET