Re: OpenGL example

From: Valeri Fine (Faine) (fine@bnl.gov)
Date: Mon Apr 03 2000 - 01:48:03 MEST


> Dear rooters,
> 
> I have just succeeded to compile my ROOT (latest version) with OpenGL
> support. I am able to open a OpenGL window and look to my geometry.
> However, I find it somehow inferior in quality to the X3d viewer. Maybe
> I am doing something wrong.
> 
> I would like to ask if somebody has a code example how to manipulate the
> objects displayed by OpenGL. I would like to use OpenGL for an event
> display (preferably an online eventdisplay). This means I am searching
> for Classes or methods that allow to change attributes of volumes like -
> in particular - the color while in OpenGL view mode. I don't want to
> close and reopen the OpenGL viewer each time I change someting.
> 

 OpenGL viewer of  ROOT is to display some 3D ROOT objects and it uses
 the attributes of those objects. This means to change the color of some 
 shape/node one has to use the methods of TShape /TNode.
 This will affect the OpenGL views of those objects too.

  Method:

  TPadView3D* TPad::GetView3D()

  returns the pointer to the current 3D viewer (it could be OpenGL viewer) if any
  See: TpadView3D.h header file:

  One may cast it to the "void TPadOpenGLView"

  TPadOpenGLView *viewer = (TPadOpenGLView *)gPad->GetView3D();

  to get an access to the methods:

//______________________________________________________________________________
void TPadOpenGLView::MoveModelView(const Char_t option, Int_t count)
{
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
//*-* option = 'u' file://*-*  Move down
//*-*          'i' file://*-*  Move up
//*-*          'h' file://*-*  Move right
//*-*          'l' file://*-*  Move left
//*-*          'j' file://*-*  Move backward
//*-*          'k' file://*-*  Move foreward
//*-*
//*-*          '+' file://*-*  Increase speed to move
//*-*          '-' file://*-*  Decrease speed to move
//*-*
//*-*          'n' file://*-*  turn "SMOOTH" color mode on
//*-*          'm' file://*-*  turn "SMOOTH" color mode off
//*-*
//*-*          't' file://*-*  toggle Light model
//*-*
//*-*          'p' file://*-*  Perspective/Orthographic projection
//*-*          'r' file://*-*  Hidden surface mode
//*-*          'w' file://*-*  wireframe mode
//*-*          'c' file://*-*  cull-face mode
//*-*
//*-*          's' file://*-*  increase  scale factor (clip cube borders)
//*-*          'a' file://*-*  decrease  scale factor (clip cube borders)
//*-*
//*-*          'x' file://*-*
//*-*          'y' file://*-*  rotate object along x,y,z axis
//*-*          'z' file://*-*
file://*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*



//______________________________________________________________________________
void TPadOpenGLView::MoveModelView(const 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 the full "chain".
//*-*                  It is assumed that a single step is performed too quickly
//*-*                  and must be slow done
//*-*              = 0;  No slowdown. It is painting as fast as the
//*-*                    present CPU allows
//*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*



> Is there some documentation smewhere on how to use OpenGl functionality
> from inside ROOT ???

  Hope that helps.
                                  Valery
> 
> 
> Thanks in advance
> 
> Tom 
> -- 
> Thomas Eberl                       Phone: (+49 89) 289 1 2425   
> Physik-Department E12, Technische Universitaet Muenchen
> James-Franck-Strasse *** D-85748 Garching b. Muenchen
> Email: Thomas.Eberl@physik.tu-muenchen.de
> 



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:22 MET