Revision 35ae36963dbb25b855e8c0f8473190c8ef0f93a4 authored by Rene Brun on 06 March 2004, 10:10:53 UTC, committed by Rene Brun on 06 March 2004, 10:10:53 UTC
Fix to a problem reported bi Dimitri Smirnov when creating a branch with a name
specified with a std::string


git-svn-id: http://root.cern.ch/svn/root/trunk@8333 27541ba8-7e3a-0410-8455-c3a389f83636
1 parent 331b515
Raw File
TGLViewerImp.cxx
// @(#)root/g3d:$Name: v3-03-09 $:$Id: TGLViewerImp.cxx,v 1.2 2000/10/13 18:59:06 rdm Exp $
// Author: Valery Fine      23/05/97

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TGLViewerImp                                                         //
//                                                                      //
// TGLViewerImp is abstract OpenGL viewer. Actual implementations are   //
// TRootGLViewer and TWin32GLViewerImp. The TGLViewer is used by the    //
// TPadOpenGLView.                                                      //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "TGLViewerImp.h"
#include "TGuiFactory.h"
#include "TROOT.h"
#include "TPadOpenGLView.h"
#include "TVirtualGL.h"


ClassImp(TGLViewerImp)

//______________________________________________________________________________
TGLViewerImp::TGLViewerImp()
{
    fDrawList = 0;
    fGLView   = 0;
    fPaint    = kFALSE;
}

//______________________________________________________________________________
TGLViewerImp::TGLViewerImp(TPadOpenGLView *, const char *, UInt_t, UInt_t)
{
    fDrawList = 0;
    fGLView   = 0;
    fPaint    = kFALSE;
}

//______________________________________________________________________________
TGLViewerImp::TGLViewerImp(TPadOpenGLView *, const char *, Int_t, Int_t, UInt_t, UInt_t)
{
    fDrawList = 0;
    fGLView   = 0;
    fPaint    = kFALSE;
}

//______________________________________________________________________________
TGLViewerImp::~TGLViewerImp()
{
   // break view / viewer relationship
   if (fGLView) {
      TPadOpenGLView *view = fGLView;
      fGLView = 0;
      view->Disconnect();
      delete view;
   }
   fPaint    = kFALSE;
   // Delete the browser.

//   gROOT->GetListOfGLViewers()->Remove(this);
}

//______________________________________________________________________________
void TGLViewerImp::DeleteView()
{ 
   if(fGLView) { 
      // some protection  to avoid a cross deleting 
      // of the  "view" and "viewer"
      TPadOpenGLView *view = fGLView;
      fGLView = 0;
      delete view; 
   } 
}

//______________________________________________________________________________
void TGLViewerImp::HandleInput(EEventType button, Int_t x, Int_t y)
{
    if (!fGLView) return;

    switch (button) {
    case kButton1Down:
    case kButton1Up:
    case kButton1Motion:
    case kKeyPress :
        fGLView->ExecuteEvent(button,x,y);
        break;
    default:
        break;
    }
}

//______________________________________________________________________________
void TGLViewerImp::Paint(Option_t *)
{
 //   if (fPaint)
    {
        MakeCurrent();
        if (fGLView) fGLView->Paint();
        //*-* Run extra GL list if any
        UInt_t list = 0;
        if ((list=GetDrawList()))
            gVirtualGL->RunGLList(list);
        gVirtualGL->FlushGL();
        SwapBuffers();
//        SetStatusText("Done",1);
 //       fPaint = kFALSE;
    }
}
back to top