2 // Main authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
4 /**************************************************************************
5 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
7 * full copyright notice. *
8 **************************************************************************/
10 #include "AliEveJetPlaneGL.h"
11 #include "AliEveJetPlane.h"
13 #include <TGLRnrCtx.h>
14 #include <TGLSelectRecord.h>
15 #include <TGLIncludes.h>
24 //==============================================================================
25 //==============================================================================
27 //==============================================================================
29 //______________________________________________________________________________
31 // GL renderer for AliEveJetPlane.
33 ClassImp(AliEveJetPlaneGL)
35 AliEveJetPlaneGL::AliEveJetPlaneGL() : TGLObject(), fM(0)
39 fDLCache = kFALSE; // Disable display list -- axis pain.
42 /******************************************************************************/
44 Bool_t AliEveJetPlaneGL::SetModel(TObject* obj, const Option_t* /*opt*/)
48 if (SetModelCheckClass(obj, AliEveJetPlane::Class())) {
49 fM = dynamic_cast<AliEveJetPlane*>(obj);
55 void AliEveJetPlaneGL::SetBBox()
59 SetAxisAlignedBBox(((AliEveJetPlane*)fExternalObj)->AssertBBox());
62 /******************************************************************************/
64 void AliEveJetPlaneGL::DirectDraw(TGLRnrCtx& rnrCtx) const
68 Float_t minEta = (fM->fMinEta)*(fM->fEtaScale);
69 Float_t maxEta = (fM->fMaxEta)*(fM->fEtaScale);
70 Float_t minPhi = (fM->fMinPhi)*(fM->fPhiScale) - 350;
71 Float_t maxPhi = (fM->fMaxPhi)*(fM->fPhiScale) - 350;
72 Float_t phiCoord, etaCoord, dPhi, dEta;
74 // Show frame for Eta-Phi coordinates
76 glBegin(GL_LINE_LOOP);
77 glVertex3f(minEta, minPhi, 0);
78 glVertex3f(maxEta, minPhi, 0);
79 glVertex3f(maxEta, maxPhi, 0);
80 glVertex3f(minEta, maxPhi, 0);
83 if (rnrCtx.Selection() == kFALSE && rnrCtx.Highlight() == kFALSE)
86 // Show grid in Eta-Phi coordinates
88 dPhi = (maxPhi-minPhi)/(fM->fNPhiDiv - 1);
89 dEta = (maxEta-minEta)/(fM->fNEtaDiv - 1);
91 for (Int_t count = 1; count < fM->fNPhiDiv-1; ++count)
93 phiCoord = minPhi + count*dPhi;
95 glVertex3f( minEta, phiCoord, 0);
96 glVertex3f( maxEta, phiCoord, 0);
100 for (Int_t count = 1; count < fM->fNEtaDiv-1; ++count)
102 etaCoord = minEta + count*dEta;
104 glVertex3f(etaCoord, minPhi, 0);
105 glVertex3f(etaCoord, maxPhi, 0);
109 // Show axis tick marks and labels
112 TGLCapabilitySwitch lightsOff(GL_LIGHTING, false);
115 ap.SetLineColor(fM->fGridColor);
116 ap.SetTextColor(fM->fGridColor);
117 TGLVector3 start, end;
119 start.Set(minEta, minPhi, 0);
120 end.Set(maxEta, minPhi, 0);
121 ap.PaintGLAxis(start.CArr(), end.CArr(), fM->fMinEta, fM->fMaxEta, 205);
123 start.Set(maxEta, minPhi, 0);
124 end.Set(maxEta, maxPhi, 0);
125 ap.PaintGLAxis(start.CArr(), end.CArr(), fM->fMinPhi, fM->fMaxPhi, 205);