Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TEveFrameBoxGL.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 "TEveFrameBoxGL.h"
13#include "TEveFrameBox.h"
14
15#include "TGLIncludes.h"
16#include "TGLUtil.h"
17
18#include "TMath.h"
19
20/** \class TEveFrameBoxGL
21\ingroup TEve
22A class encapsulating GL rendering of TEveFrameBox via a static member function.
23*/
24
26
27////////////////////////////////////////////////////////////////////////////////
28/// Render the frame with GL.
29
31{
32 const Float_t * p = b.fFramePoints;
33 Float_t normal[3];
34
35 if (b.fFrameType == TEveFrameBox::kFT_Quad)
36 {
37 if (fillp)
38 {
42 }
43 else
44 {
45 glBegin(GL_LINE_LOOP);
46 }
47 Int_t nPoints = b.fFrameSize / 3;
48 for (Int_t i = 0; i < nPoints; ++i, p += 3)
50 glEnd();
51 }
52 else if (b.fFrameType == TEveFrameBox::kFT_Box)
53 {
54 if (fillp)
55 {
60 glVertex3fv(p + 6); glVertex3fv(p + 9);
61 // top: 7654
62 TMath::Normal2Plane(p+21, p+18, p+15, normal);
64 glVertex3fv(p + 21); glVertex3fv(p + 18);
65 glVertex3fv(p + 15); glVertex3fv(p + 12);
66 // back: 0451
67 TMath::Normal2Plane(p, p+12, p+15, normal);
69 glVertex3fv(p); glVertex3fv(p + 12);
70 glVertex3fv(p + 15); glVertex3fv(p + 3);
71 // front: 3267
72 TMath::Normal2Plane(p+9, p+6, p+18, normal);
74 glVertex3fv(p + 9); glVertex3fv(p + 6);
75 glVertex3fv(p + 18); glVertex3fv(p + 21);
76 // left: 0374
80 glVertex3fv(p + 21); glVertex3fv(p + 12);
81 // right: 1562
82 TMath::Normal2Plane(p+3, p+15, p+18, normal);
84 glVertex3fv(p + 3); glVertex3fv(p + 15);
85 glVertex3fv(p + 18); glVertex3fv(p + 6);
86 glEnd();
87 }
88 else
89 {
90 glBegin(GL_LINE_STRIP);
92 glVertex3fv(p + 6); glVertex3fv(p + 9);
94 glVertex3fv(p + 12); glVertex3fv(p + 15);
95 glVertex3fv(p + 18); glVertex3fv(p + 21);
96 glVertex3fv(p + 12);
97 glEnd();
98 glBegin(GL_LINES);
99 glVertex3fv(p + 3); glVertex3fv(p + 15);
100 glVertex3fv(p + 6); glVertex3fv(p + 18);
101 glVertex3fv(p + 9); glVertex3fv(p + 21);
102 glEnd();
103 }
104 }
105}
106
107////////////////////////////////////////////////////////////////////////////////
108/// Render the frame-box with GL.
109
#define b(i)
Definition RSha256.hxx:100
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
#define ClassImp(name)
Definition Rtypes.h:374
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
A class encapsulating GL rendering of TEveFrameBox via a static member function.
static void RenderFrame(const TEveFrameBox &b, Bool_t fillp)
Render the frame with GL.
static void Render(const TEveFrameBox *box)
Render the frame-box with GL.
Description of a 2D or 3D frame that can be used to visually group a set of objects.
static void Color4ubv(const UChar_t *rgba)
Wrapper for glColor4ubv.
Definition TGLUtil.cxx:1779
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition TGLUtil.cxx:1943
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
Definition fillpatterns.C:1
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
Definition TMath.h:1292