CMS 3D CMS Logo

List of all members | Public Member Functions
FWEveTextGL Class Reference

#include <FWTextProjected.h>

Inheritance diagram for FWEveTextGL:

Public Member Functions

 ClassDefOverride (FWEveTextGL, 0)
 
void DirectDraw (TGLRnrCtx &rnrCtx) const override
 
 FWEveTextGL ()
 
 ~FWEveTextGL () override
 

Detailed Description

Definition at line 64 of file FWTextProjected.h.

Constructor & Destructor Documentation

◆ FWEveTextGL()

FWEveTextGL::FWEveTextGL ( )
inline

Definition at line 66 of file FWTextProjected.h.

66 {}

◆ ~FWEveTextGL()

FWEveTextGL::~FWEveTextGL ( )
inlineoverride

Definition at line 67 of file FWTextProjected.h.

67 {}

Member Function Documentation

◆ ClassDefOverride()

FWEveTextGL::ClassDefOverride ( FWEveTextGL  ,
 
)

◆ DirectDraw()

void FWEveTextGL::DirectDraw ( TGLRnrCtx &  rnrCtx) const
override

Definition at line 54 of file FWTextProjected.cc.

References isotrackApplyRegressor::model, x, y, and z.

54  {
55  Int_t fm = fM->GetFontMode();
56  if (fm == TGLFont::kBitmap || fm == TGLFont::kPixmap || fm == TGLFont::kTexture)
57  rnrCtx.RegisterFont(fM->GetFontSize(), fM->GetFontFile(), fM->GetFontMode(), fFont);
58  else
59  rnrCtx.RegisterFontNoScale(fM->GetFontSize(), fM->GetFontFile(), fM->GetFontMode(), fFont);
60 
61  // rendering
62  glPushMatrix();
63  fFont.PreRender(fM->GetAutoLighting(), fM->GetLighting());
64 
65  const GLdouble* pm = rnrCtx.RefCamera().RefLastNoPickProjM().CArr();
66 
67  GLdouble mm[16];
68  GLint vp[4];
69  glGetDoublev(GL_MODELVIEW_MATRIX, mm);
70  glGetIntegerv(GL_VIEWPORT, vp);
71 
72  fX[0][0] = fX[0][1] = fX[0][2] = 0;
73  GLdouble x, y, z;
74  gluProject(fX[0][0], fX[0][1], fX[0][2], mm, pm, vp, &x, &y, &z);
75  Float_t bbox[6];
76  fFont.BBox(fM->GetText(), bbox[0], bbox[1], bbox[2], bbox[3], bbox[4], bbox[5]);
77 
78  gluUnProject(x + bbox[0], y + bbox[1], z, mm, pm, vp, &fX[0][0], &fX[0][1], &fX[0][2]);
79  gluUnProject(x + bbox[3], y + bbox[1], z, mm, pm, vp, &fX[1][0], &fX[1][1], &fX[1][2]);
80  gluUnProject(x + bbox[3], y + bbox[4], z, mm, pm, vp, &fX[2][0], &fX[2][1], &fX[2][2]);
81  gluUnProject(x + bbox[0], y + bbox[4], z, mm, pm, vp, &fX[3][0], &fX[3][1], &fX[3][2]);
82  glEnable(GL_POLYGON_OFFSET_FILL);
83 
84  FWEveText* model = (FWEveText*)fM;
85  double xm = fX[0][0] - model->m_textPad;
86  double xM = fX[2][0] + model->m_textPad;
87  double ym = fX[0][1] - model->m_textPad;
88  double yM = fX[2][1] + model->m_textPad;
89 
90  // TGLUtil::Color(1016);
91  if (rnrCtx.ColorSet().Background().GetRed())
92  TGLUtil::Color(kWhite);
93  else
94  TGLUtil::Color(kBlack);
95 
96  glPolygonOffset(1, 1);
97  glBegin(GL_POLYGON);
98  glVertex2d(xm, ym);
99  glVertex2d(xM, ym);
100  glVertex2d(xM, yM);
101  glVertex2d(xm, yM);
102 
103  glEnd();
104 
105  TGLUtil::Color(fM->GetMainColor());
106  if (true) {
107  glPolygonOffset(0, 0);
108  glBegin(GL_LINE_LOOP);
109  glVertex2d(xm, ym);
110  glVertex2d(xM, ym);
111  glVertex2d(xM, yM);
112  glVertex2d(xm, yM);
113  glEnd();
114  }
115 
116  glPolygonOffset(0, 0);
117 
118  glRasterPos3i(0, 0, 0);
119  fFont.Render(fM->GetText());
120  fFont.PostRender();
121  glPopMatrix();
122 }