CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
FWEveTextGL Class Reference

#include <FWTextProjected.h>

Inheritance diagram for FWEveTextGL:

Public Member Functions

 ClassDef (FWEveTextGL, 0)
 
virtual void DirectDraw (TGLRnrCtx &rnrCtx) const
 
 FWEveTextGL ()
 
virtual ~FWEveTextGL ()
 

Detailed Description

Definition at line 71 of file FWTextProjected.h.

Constructor & Destructor Documentation

FWEveTextGL::FWEveTextGL ( )
inline

Definition at line 74 of file FWTextProjected.h.

74 {}
virtual FWEveTextGL::~FWEveTextGL ( )
inlinevirtual

Definition at line 75 of file FWTextProjected.h.

75 {}

Member Function Documentation

FWEveTextGL::ClassDef ( FWEveTextGL  ,
 
)
void FWEveTextGL::DirectDraw ( TGLRnrCtx &  rnrCtx) const
virtual

Definition at line 59 of file FWTextProjected.cc.

References FWEveText::m_textPad, x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

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