CMS 3D CMS Logo

Public Member Functions

FWEveTextGL Class Reference

#include <FWTextProjected.h>

List of all members.

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.

{}
virtual FWEveTextGL::~FWEveTextGL ( ) [inline, virtual]

Definition at line 75 of file FWTextProjected.h.

{}

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 z.

{

   Int_t fm = fM->GetFontMode();
   if (fm == TGLFont::kBitmap || fm == TGLFont::kPixmap || fm == TGLFont::kTexture)
      rnrCtx.RegisterFont(fM->GetFontSize(), fM->GetFontFile(), fM->GetFontMode(), fFont);
   else
      rnrCtx.RegisterFontNoScale(fM->GetFontSize(), fM->GetFontFile(), fM->GetFontMode(), fFont);


   // rendering
   glPushMatrix();
   fFont.PreRender(fM->GetAutoLighting(), fM->GetLighting());
  

   const GLdouble *pm = rnrCtx.RefCamera().RefLastNoPickProjM().CArr(); 

   GLdouble mm[16];
   GLint    vp[4];
   glGetDoublev(GL_MODELVIEW_MATRIX,  mm);
   glGetIntegerv(GL_VIEWPORT, vp);

   fX[0][0] = fX[0][1] = fX[0][2] = 0;
   GLdouble x, y, z;
   gluProject(fX[0][0], fX[0][1], fX[0][2], mm, pm, vp, &x, &y, &z);
   Float_t bbox[6];
   fFont.BBox(fM->GetText(), bbox[0], bbox[1], bbox[2],
              bbox[3], bbox[4], bbox[5]);

 
   gluUnProject(x + bbox[0], y + bbox[1], z, mm, pm, vp, &fX[0][0], &fX[0][1], &fX[0][2]);
   gluUnProject(x + bbox[3], y + bbox[1], z, mm, pm, vp, &fX[1][0], &fX[1][1], &fX[1][2]);
   gluUnProject(x + bbox[3], y + bbox[4], z, mm, pm, vp, &fX[2][0], &fX[2][1], &fX[2][2]);
   gluUnProject(x + bbox[0], y + bbox[4], z, mm, pm, vp, &fX[3][0], &fX[3][1], &fX[3][2]);
   glEnable(GL_POLYGON_OFFSET_FILL);
           
   FWEveText* model = (FWEveText*)fM; 
   double xm =  fX[0][0] - model->m_textPad;
   double xM =  fX[2][0] + model->m_textPad;
   double ym =  fX[0][1] - model->m_textPad;
   double yM =  fX[2][1] + model->m_textPad;


   //   TGLUtil::Color(1016);
   if (rnrCtx.ColorSet().Background().GetRed())
      TGLUtil::Color(kWhite);
   else
      TGLUtil::Color(kBlack);

   glPolygonOffset(1,1 );
   glBegin(GL_POLYGON);
   glVertex2d(xm, ym);
   glVertex2d(xM, ym);
   glVertex2d(xM, yM);
   glVertex2d(xm, yM);

   glEnd();
 
   TGLUtil::Color(fM->GetMainColor());
   if (1) {
      glPolygonOffset(0, 0 );
      glBegin(GL_LINE_LOOP);
      glVertex2d(xm, ym);
      glVertex2d(xM, ym);
      glVertex2d(xM, yM);
      glVertex2d(xm, yM);
      glEnd();
   }

   glPolygonOffset(0, 0  );

   glRasterPos3i(0, 0, 0);
   fFont.Render(fM->GetText());
   fFont.PostRender();
   glPopMatrix();
}