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
25
26////////////////////////////////////////////////////////////////////////////////
27/// Render the frame with GL.
28
30{
31 const Float_t * p = b.fFramePoints;
32 Float_t normal[3];
33
34 if (b.fFrameType == TEveFrameBox::kFT_Quad)
35 {
36 if (fillp)
37 {
41 }
42 else
43 {
44 glBegin(GL_LINE_LOOP);
45 }
46 Int_t nPoints = b.fFrameSize / 3;
47 for (Int_t i = 0; i < nPoints; ++i, p += 3)
49 glEnd();
50 }
51 else if (b.fFrameType == TEveFrameBox::kFT_Box)
52 {
53 if (fillp)
54 {
59 glVertex3fv(p + 6); glVertex3fv(p + 9);
60 // top: 7654
61 TMath::Normal2Plane(p+21, p+18, p+15, normal);
63 glVertex3fv(p + 21); glVertex3fv(p + 18);
64 glVertex3fv(p + 15); glVertex3fv(p + 12);
65 // back: 0451
66 TMath::Normal2Plane(p, p+12, p+15, normal);
68 glVertex3fv(p); glVertex3fv(p + 12);
69 glVertex3fv(p + 15); glVertex3fv(p + 3);
70 // front: 3267
71 TMath::Normal2Plane(p+9, p+6, p+18, normal);
73 glVertex3fv(p + 9); glVertex3fv(p + 6);
74 glVertex3fv(p + 18); glVertex3fv(p + 21);
75 // left: 0374
79 glVertex3fv(p + 21); glVertex3fv(p + 12);
80 // right: 1562
81 TMath::Normal2Plane(p+3, p+15, p+18, normal);
83 glVertex3fv(p + 3); glVertex3fv(p + 15);
84 glVertex3fv(p + 18); glVertex3fv(p + 6);
85 glEnd();
86 }
87 else
88 {
89 glBegin(GL_LINE_STRIP);
91 glVertex3fv(p + 6); glVertex3fv(p + 9);
93 glVertex3fv(p + 12); glVertex3fv(p + 15);
94 glVertex3fv(p + 18); glVertex3fv(p + 21);
95 glVertex3fv(p + 12);
96 glEnd();
97 glBegin(GL_LINES);
98 glVertex3fv(p + 3); glVertex3fv(p + 15);
99 glVertex3fv(p + 6); glVertex3fv(p + 18);
100 glVertex3fv(p + 9); glVertex3fv(p + 21);
101 glEnd();
102 }
103 }
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Render the frame-box with GL.
108
#define b(i)
Definition RSha256.hxx:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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:1770
static Float_t LineWidth()
Get the line-width, taking the global scaling into account.
Definition TGLUtil.cxx:1934
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:1299