library: libRGL #include "TViewerOpenGL.h"

# TViewerOpenGL

class description - source file - inheritance tree (.pdf)

## class TViewerOpenGL : public TVirtualViewer3D, public TGMainFrame, public TGLViewer

| Inheritance Chart:
`TVirtualViewer3D`
`TObject`
| <- | `TGObject`
| <- | `TGWindow`
`TQObject`
| <- | `TGFrame`
| <- | `TGCompositeFrame`
| <- | `TGMainFrame`
`TGLViewer`
| <- | `TViewerOpenGL` |

        private:

                             TViewerOpenGL(const TViewerOpenGL&)
          RootCsg::BaseMesh* BuildComposite()
                virtual void CloseWindow()
            TGLLogicalShape* CreateNewLogical(const TBuffer3D& buffer) const
           TGLPhysicalShape* CreateNewPhysical(UInt_t physicalID, const TBuffer3D& buffer, const TGLLogicalShape& logical) const
                        void CreateViewer()
                virtual void DoRedraw()
                        void DoSelect(Event_t* event, Bool_t invokeContext)
                virtual void InitGL()
                virtual void Invalidate(UInt_t redrawLOD = kMed)
                virtual void MakeCurrent() const
              TViewerOpenGL& operator=(const TViewerOpenGL&)
                        void PrintObjects()
              virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2)
              virtual Bool_t RebuildScene()
                        void Show()
                virtual void SwapBuffers() const
                       Int_t ValidateObjectBuffer(const TBuffer3D& buffer, Bool_t logical) const

        public:

                          TViewerOpenGL(TVirtualPad* pad)
                          ~TViewerOpenGL()
             virtual void AddCompositeOp(UInt_t operation)
            virtual Int_t AddObject(const TBuffer3D& buffer, Bool_t* addChildren = 0)
            virtual Int_t AddObject(UInt_t physicalID, const TBuffer3D& buffer, Bool_t* addChildren = 0)
             virtual void BeginScene()
           virtual Bool_t BuildingScene() const
           static TClass* Class()
             virtual void CloseComposite()
             virtual void EndScene()
                   Bool_t HandleContainerButton(Event_t* ev)
                   Bool_t HandleContainerConfigure(Event_t* ev)
                   Bool_t HandleContainerDoubleClick(Event_t* ev)
                   Bool_t HandleContainerEvent(Event_t* ev)
                   Bool_t HandleContainerExpose(Event_t* ev)
                   Bool_t HandleContainerKey(Event_t* ev)
                   Bool_t HandleContainerMotion(Event_t* ev)
          virtual TClass* IsA() const
                     void ModifyScene(Int_t id)
           virtual Bool_t OpenComposite(const TBuffer3D& buffer, Bool_t* addChildren = 0)
           virtual Bool_t PreferLocalFrame() const
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

               TGCompositeFrame* fMainFrame
                TGVerticalFrame* fV1
                TGVerticalFrame* fV2
                      TGShutter* fShutter
                  TGShutterItem* fShutItem1
                  TGShutterItem* fShutItem2
                  TGShutterItem* fShutItem3
                  TGShutterItem* fShutItem4
                  TGLayoutHints* fL1
                  TGLayoutHints* fL2
                  TGLayoutHints* fL3
                  TGLayoutHints* fL4
                  TGLayoutHints* fCanvasLayout
                      TGMenuBar* fMenuBar
                    TGPopupMenu* fFileMenu
                    TGPopupMenu* fViewMenu
                    TGPopupMenu* fHelpMenu
                  TGLayoutHints* fMenuBarLayout
                  TGLayoutHints* fMenuBarItemLayout
                  TGLayoutHints* fMenuBarHelpLayout
                   TContextMenu* fContextMenu
                       TGCanvas* fCanvasWindow
                  TGLRenderArea* fCanvasContainer
                 TGLColorEditor* fColorEditor
              TGLGeometryEditor* fGeomEditor
                 TGLSceneEditor* fSceneEditor
                 TGLLightEditor* fLightEditor
          TViewerOpenGL::EAction fAction
                          TPoint fStartPos
                          TPoint fLastPos
                          UInt_t fActiveButtonID
                          Bool_t fInternalRebuild       ! internal scene rebuild in progress?
                          Bool_t fAcceptedAllPhysicals  ! did we take all physicals offered in AddObject()
                          Bool_t fInternalPIDs          ! using internal physical IDs
                          UInt_t fNextInternalPID       ! next internal physical ID (from 1 - 0 reserved)
                           Int_t fLightMask
                    TVirtualPad* fPad
                     TGLFaceSet* fComposite             ! Paritally created composite
                          UInt_t fCSLevel
                vector<CSPART_t> fCSTokens
                          UInt_t fAcceptedPhysicals
                          UInt_t fRejectedPhysicals
              static const Int_t fgInitX
              static const Int_t fgInitY
              static const Int_t fgInitW
              static const Int_t fgInitH

        public:

          static const TViewerOpenGL::EAction kNone
          static const TViewerOpenGL::EAction kRotate
          static const TViewerOpenGL::EAction kTruck
          static const TViewerOpenGL::EAction kDolly
          static const TViewerOpenGL::EAction kDrag

## Class Description

TViewerOpenGL(TVirtualPad * pad) : TGMainFrame(gClient->GetDefaultRoot(), fgInitW, fgInitH), fMainFrame(0), fV1(0), fV2(0), fShutter(0), fShutItem1(0), fShutItem2(0), fShutItem3(0), fShutItem4(0), fL1(0), fL2(0), fL3(0), fL4(0), fCanvasLayout(0), fMenuBar(0), fFileMenu(0), fViewMenu(0), fHelpMenu(0), fMenuBarLayout(0), fMenuBarItemLayout(0), fMenuBarHelpLayout(0), fContextMenu(0), fCanvasWindow(0), fCanvasContainer(0), fColorEditor(0), fGeomEditor(0), fSceneEditor(0), fLightEditor(0), fAction(kNone), fStartPos(0,0), fLastPos(0,0), fActiveButtonID(0), fInternalRebuild(kFALSE), fAcceptedAllPhysicals(kTRUE), fInternalPIDs(kFALSE), fNextInternalPID(1), // 0 reserved fLightMask(0x1b), fPad(pad), fComposite(0), fCSLevel(0), fAcceptedPhysicals(0), fRejectedPhysicals(0)

     Create OpenGL viewer.

void CreateViewer()

     Menus creation

~TViewerOpenGL()

void InitGL()

     Actual GL window/context creation should have already been done in CreateViewer()

void Invalidate(UInt_t redrawLOD)

void MakeCurrent() const

void SwapBuffers() const

Bool_t HandleContainerEvent(Event_t *event)

Bool_t HandleContainerButton(Event_t *event)

Bool_t HandleContainerDoubleClick(Event_t *event)

Bool_t HandleContainerConfigure(Event_t *event)

Bool_t HandleContainerKey(Event_t *event)

Bool_t HandleContainerMotion(Event_t *event)

Bool_t HandleContainerExpose(Event_t *)

void DoSelect(Event_t *event, Bool_t invokeContext)

     Take select lock on scene immediately we enter here - it is released
     in the other (drawing) thread - see TGLViewer::Select()
     Removed when gVirtualGL removed

void Show()

void CloseWindow()

void DoRedraw()

     Take draw lock on scene immediately we enter here - it is released
     in the other (drawing) drawing thread - see TGLViewer::Draw()
     Removed when gVirtualGL removed

void PrintObjects()

Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t)

void ModifyScene(Int_t wid)

Bool_t PreferLocalFrame() const

void BeginScene()

void EndScene()

Bool_t RebuildScene()

     If we accepted all offered physicals into the scene no point in
     rebuilding it

Int_t AddObject(const TBuffer3D & buffer, Bool_t * addChildren)

     Add an object to the viewer, using internal physical IDs

Int_t AddObject(UInt_t physicalID, const TBuffer3D & buffer, Bool_t * addChildren)

     Add an object to the viewer, using an external physical ID.

Int_t ValidateObjectBuffer(const TBuffer3D & buffer, Bool_t logical) const

     kCore: Should always be filled

TGLLogicalShape* CreateNewLogical(const TBuffer3D & buffer) const

     Buffer should now be correctly filled

TGLPhysicalShape* CreateNewPhysical(UInt_t ID, const TBuffer3D & buffer, const TGLLogicalShape & logical) const

     Extract indexed color from buffer
     TODO: Still required? Better use proper color triplet in buffer?

Bool_t OpenComposite(const TBuffer3D & buffer, Bool_t * addChildren)

void CloseComposite()

     If we have a partially complete composite build it now

void AddCompositeOp(UInt_t operation)

RootCsg::BaseMesh* BuildComposite()

### Inline Functions

                    Bool_t BuildingScene() const
             TViewerOpenGL TViewerOpenGL(const TViewerOpenGL&)
            TViewerOpenGL& operator=(const TViewerOpenGL&)
                   TClass* Class()
                   TClass* IsA() const
                      void ShowMembers(TMemberInspector& insp, char* parent)
                      void Streamer(TBuffer& b)
                      void StreamerNVirtual(TBuffer& b)

Author: Timur Pocheptsov 03/08/2004
Last update: root/gl:$Name: $:$Id: TViewerOpenGL.cxx,v 1.67 2005/06/24 14:28:57 brun Exp $
Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. *