3 #include <TAttMarker.h>
4 #include <TGLIncludes.h>
8 void RenderPolyMarkers(TAttMarker& marker, Float_t* p, Int_t n,
9 Bool_t selection, Bool_t sec_selection)
11 // Store attributes GL_POINT_BIT and GL_LINE_BIT before call this function !
13 Int_t s = marker.GetMarkerStyle();
14 if (s == 2 || s == 3 || s == 5 || s == 28)
15 RenderCrosses(marker, p, n, sec_selection);
17 RenderPoints(marker, p, n, selection, sec_selection);
20 //______________________________________________________________________________
21 void RenderPoints(TAttMarker& marker, Float_t* p, Int_t n,
22 Bool_t selection, Bool_t sec_selection)
24 // Render markers as circular or square points.
26 Int_t ms = marker.GetMarkerStyle();
27 Float_t size = 5*marker.GetMarkerSize();
28 if (ms == 4 || ms == 20 || ms == 24)
30 if (ms == 4 || ms == 24)
32 glEnable(GL_POINT_SMOOTH);
35 glDisable(GL_POINT_SMOOTH);
36 if (ms == 1) size = 1;
37 else if (ms == 6) size = 2;
38 else if (ms == 7) size = 3;
42 // During selection extend picking region for large point-sizes.
43 static const Int_t sPickRadius = 3; // Hardcoded also in TGLViewer::RequestSelect()
44 Bool_t changePM = kFALSE;
45 if (selection && size > sPickRadius)
48 glMatrixMode(GL_PROJECTION);
51 glGetFloatv(GL_PROJECTION_MATRIX, pm);
52 Float_t scale = (Float_t) sPickRadius / size;
53 for (Int_t i=0; i<=12; i+=4) {
54 pm[i] *= scale; pm[i+1] *= scale;
62 for (Int_t i=0; i<n; ++i, p+=3)
73 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT);
74 glVertexPointer(3, GL_FLOAT, 0, p);
75 glEnableClientState(GL_VERTEX_ARRAY);
76 { // Circumvent bug in ATI's linux drivers.
79 const Int_t maxChunk = 8192;
80 while (nleft > maxChunk)
82 glDrawArrays(GL_POINTS, ndone, maxChunk);
86 glDrawArrays(GL_POINTS, ndone, nleft);
94 glMatrixMode(GL_MODELVIEW);
99 //______________________________________________________________________________
100 void RenderCrosses(TAttMarker& marker, Float_t* p, Int_t n,
101 Bool_t sec_selection)
103 // Render markers as crosses.
105 if (marker.GetMarkerStyle() == 28)
108 glEnable(GL_LINE_SMOOTH);
113 glDisable(GL_LINE_SMOOTH);
117 const Float_t d = marker.GetMarkerSize();
121 for (Int_t i=0; i<n; ++i, p+=3)
125 glVertex3f(p[0]-d, p[1], p[2]); glVertex3f(p[0]+d, p[1], p[2]);
126 glVertex3f(p[0], p[1]-d, p[2]); glVertex3f(p[0], p[1]+d, p[2]);
127 glVertex3f(p[0], p[1], p[2]-d); glVertex3f(p[0], p[1], p[2]+d);
135 for (Int_t i=0; i<n; ++i, p+=3)
137 glVertex3f(p[0]-d, p[1], p[2]); glVertex3f(p[0]+d, p[1], p[2]);
138 glVertex3f(p[0], p[1]-d, p[2]); glVertex3f(p[0], p[1]+d, p[2]);
139 glVertex3f(p[0], p[1], p[2]-d); glVertex3f(p[0], p[1], p[2]+d);
145 /**************************************************************************/
146 } // end namespace GLUtilNS