Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TEveLineGL.cxx
Go to the documentation of this file.
1 // @(#)root/eve:$Id$
2 // Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #include "TEveLineGL.h"
13 #include "TEveLine.h"
14 
15 #include "TGLRnrCtx.h"
16 #include "TGLIncludes.h"
17 
18 /** \class TEveLineGL
19 \ingroup TEve
20 GL-renderer for TEveLine class.
21 */
22 
23 ClassImp(TEveLineGL);
24 
25 ////////////////////////////////////////////////////////////////////////////////
26 /// Constructor.
27 
28 TEveLineGL::TEveLineGL() : TPointSet3DGL(), fM(0)
29 {
30  // fDLCache = false; // Disable display list.
31  fMultiColor = kTRUE;
32 }
33 
34 ////////////////////////////////////////////////////////////////////////////////
35 /// Set model object.
36 
37 Bool_t TEveLineGL::SetModel(TObject* obj, const Option_t* /*opt*/)
38 {
39  fM = SetModelDynCast<TEveLine>(obj);
40  return kTRUE;
41 }
42 
43 ////////////////////////////////////////////////////////////////////////////////
44 /// Direct GL rendering for TEveLine.
45 
46 void TEveLineGL::DirectDraw(TGLRnrCtx & rnrCtx) const
47 {
48  // printf("TEveLineGL::DirectDraw Style %d, LOD %d\n", rnrCtx.Style(), rnrCtx.LOD());
49 
50  TEveLine& q = *fM;
51  if (q.Size() <= 0) return;
52 
53  TGLUtil::LockColor(); // Keep color from TGLPhysicalShape.
54  if (q.fRnrLine) {
55  TGLCapabilityEnabler sw_smooth(GL_LINE_SMOOTH, q.fSmooth);
56  TGLCapabilityEnabler sw_blend(GL_BLEND, q.fSmooth);
57  TGLUtil::RenderPolyLine(q, q.GetMainTransparency(), q.GetP(), q.Size());
58  }
59  TGLUtil::UnlockColor();
60  if (q.fRnrPoints) {
61  TGLUtil::RenderPolyMarkers(q, 0,q.GetP(), q.Size(),
62  rnrCtx.GetPickRadius(),
63  rnrCtx.Selection());
64  }
65 }