]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/Reve/LineGL.cxx
Missing initialization; fiddle with the track marker-style a bit more.
[u/mrichter/AliRoot.git] / EVE / Reve / LineGL.cxx
CommitLineData
6f04ebee 1// $Header$
2
3#include "LineGL.h"
4#include <Reve/Line.h>
5
6#include <TGLDrawFlags.h>
7
8#ifdef WIN32
9#include "Windows4root.h"
10#endif
11#include <GL/gl.h>
12#include <GL/glu.h>
13
14using namespace Reve;
15
16//______________________________________________________________________
17// LineGL
18//
19
20ClassImp(LineGL)
21
22LineGL::LineGL() : TPointSet3DGL(), fM(0)
23{
24 // fCached = false; // Disable display list.
25}
26
27LineGL::~LineGL()
28{}
29
30/**************************************************************************/
31
32Bool_t LineGL::SetModel(TObject* obj)
33{
34 // TPointSet3DGL::SetModel(obj);
35 if(SetModelCheckClass(obj, Line::Class())) {
36 fM = dynamic_cast<Line*>(obj);
37 return kTRUE;
38 }
39 return kFALSE;
40}
41
42/**************************************************************************/
43
44void LineGL::DirectDraw(const TGLDrawFlags & flags) const
45{
46 // printf("LineGL::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD());
47
48 Line& q = *fM;
49 if (q.Size() <= 0) return;
50
51 glPushAttrib(GL_POINT_BIT | GL_LINE_BIT | GL_ENABLE_BIT);
52 glDisable(GL_LIGHTING);
53
54 UChar_t color[4];
55
56 if (q.fRnrLine)
57 {
58 glPushAttrib(GL_LINE_BIT);
59 ColorFromIdx(q.GetLineColor(), color);
60 glColor4ubv(color);
61 glLineWidth(q.GetLineWidth());
62 if (q.GetLineStyle() > 1) {
63 Int_t fac = 1;
64 UShort_t pat = 0xffff;
65 switch (q.GetLineStyle()) {
66 case 2: pat = 0x3333; break;
67 case 3: pat = 0x5555; break;
68 case 4: pat = 0xf040; break;
69 case 5: pat = 0xf4f4; break;
70 case 6: pat = 0xf111; break;
71 case 7: pat = 0xf0f0; break;
72 case 8: pat = 0xff11; break;
73 case 9: pat = 0x3fff; break;
74 case 10: pat = 0x08ff; fac = 2; break;
75 }
76
77 glLineStipple(1, pat);
78 glEnable(GL_LINE_STIPPLE);
79 }
80
81 const Float_t* p = q.GetP();
82 const Int_t n = q.Size();
83 glBegin(GL_LINE_STRIP);
84 for (Int_t i=0; i<n; ++i, p+=3)
85 glVertex3fv(p);
86 glEnd();
87 glPopAttrib();
88 }
89
90 if (q.fRnrPoints)
91 {
92 ColorFromIdx(q.GetMarkerColor(), color);
93 glColor4ubv(color);
94 Int_t ms = q.GetMarkerStyle();
95 if (ms != 2 && ms != 3 && ms != 5 && ms != 28)
96 RenderPoints(flags);
97 else
98 RenderCrosses(flags);
99 }
100
101 glPopAttrib();
102}