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 70 of file FWTextProjected.h.

Constructor & Destructor Documentation

FWEveTextGL::FWEveTextGL ( )
inline

Definition at line 73 of file FWTextProjected.h.

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

Definition at line 74 of file FWTextProjected.h.

74 {}

Member Function Documentation

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

Definition at line 58 of file FWTextProjected.cc.

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

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