Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

TridSketches.cxx

Go to the documentation of this file.
00001 #include "TridSketches.h"
00002 
00003 #include "MessageService/MsgService.h"
00004 
00005 #include "TROOT.h"
00006 #include "TGX11.h"
00007 #include "TVirtualX.h"
00008 #include "TMath.h"
00009 #include "KeySymbols.h"
00010 
00011 #include <GL/gl.h>
00012 #include <GL/glx.h>
00013 #include <GL/glu.h>
00014 #include "glf.h"
00015 #include <iostream>
00016 using namespace std;
00017 
00018 CVSID("$Id: TridSketches.cxx,v 1.22 2007/09/14 14:12:19 tagg Exp $");
00019 
00020 ClassImp(TridSketch)
00021 
00022 unsigned int TridSketch::fgSketchIdCounter = 1;
00023 TVector3     TridSketch::fgDefaultColor = TVector3( 1,1,1 );
00024 float        TridSketch::fgDefaultTrans = 1.0;
00025 Bool_t       TridSketch::fgScenery = false;
00026 
00027 TridSketch::TridSketch( int type, TVector3 center ) :
00028   fType( type ),
00029   fHighlighted( false ),
00030   fToggle( true ),
00031   fScenery( fgScenery ),
00032   fTime( -999. ),
00033   fCallList( 0 ),
00034   fCenter( center )
00035 {
00036   // Default constructor for base clase. 
00037   //
00038   fId = fgSketchIdCounter;
00039   fgSketchIdCounter++;
00040 
00041   fColor = fgDefaultColor;
00042   fTransparency = fgDefaultTrans;
00043 }
00044 
00045 /*
00046 TridSketch::TridSketch( float red, float green, float blue, float trans) :
00047   fType( kNull ),
00048   fColor(red,green,blue),
00049   fTransparency(trans),
00050   fHighlighted( false ),
00051   fToggle( true ),
00052   fTime( -999. ),
00053   fCallList(0)
00054 {
00055   // Default constructor for base clase. 
00056   //
00057   fId = fgSketchIdCounter;
00058   fgSketchIdCounter++;
00059 }
00060 */
00061 
00062 TridSketch::~TridSketch( void )
00063 {
00064   glDeleteLists(fCallList,1);
00065 }
00066 
00067 void 
00068 TridSketch::SetDirty( void ) 
00069 {
00070   glDeleteLists(fCallList,1);
00071   fCallList = 0;
00072 }
00073 
00074 Bool_t
00075 TridSketch::Draw( double timestart, double timeend ) 
00076 {
00077   // Interface to specific drawing routines.
00078   // Handles some things common to all sketches.
00079 
00080   // Returns true if something actually got drawn.
00081   if(fToggle) {
00082     if( (fScenery) || // Scenery is always drawn
00083         ( ( fTime >= timestart ) && ( fTime < timeend ) ) // Other things get time-chopped.
00084         ) {
00085       
00086       // Change color:
00087       glColor4f(fColor.x(),fColor.y(),fColor.z(),fTransparency);
00088       
00089       if(fCallList == 0) {
00090         // Create the cached draw commands.
00091         fCallList = glGenLists(1);
00092         if(fCallList) {
00093           glNewList(fCallList,GL_COMPILE_AND_EXECUTE);
00094           glLoadName(fId);      
00095           this->DrawSelf();
00096           glEndList();
00097         } else {
00098           glLoadName(fId);
00099           this->DrawSelf();
00100           // Call list was not generated.. create an error
00101           MSG("TriD",Msg::kWarning) << "OpenGL problem: Could not create a new display list." << endl;
00102         }
00103       } else {
00104         glCallList(fCallList);
00105       }
00106       
00107       return true;
00108       
00109     }
00110   }
00111   return false;
00112 }
00113 
00114 
00115 void TridSketch::GlVertexTVector( TVector3& vect )
00116 {
00117   //
00118   // Orders a glVertex given a ROOT 3-vector
00119   //
00120   glVertex3d(vect.x(), vect.y(), vect.z() );
00121 }
00122 
00123 double TridSketch::ComputeApparentZ(double* modelViewMatrix)
00124 {
00125   fApparentZ = 
00126     modelViewMatrix[2] *fCenter.x() +
00127     modelViewMatrix[6] *fCenter.y() +
00128     modelViewMatrix[10]*fCenter.z()*10000.;  
00129   return fApparentZ;
00130 }
00131 
00132  
00135 
00136 ClassImp(TridSketchLine)
00137 
00138 TridSketchLine::TridSketchLine( float x1, float y1, float z1, float x2, float y2, float z2 )
00139   : TridSketch(kLine, TVector3((x1+x2)*0.5,(y1+y2)*0.5,(z1+z2)*0.5) )
00140   , fWidth(1.0), fStipple(-1)
00141 {
00142   //
00143   // Defines a line using the x,y,z coords of the two endpoints.
00144   //
00145   p[0].SetXYZ(x1,y1,z1);
00146   p[1].SetXYZ(x2,y2,z2);
00147 }
00148 
00149 TridSketchLine::TridSketchLine( const TVector3& inp1, const TVector3& inp2 )
00150   : TridSketch( kLine, (inp1 + inp2)*0.5 )
00151   , fWidth(1.0), fStipple(-1)
00152 {
00153   //
00154   // Defines a line using 3-vectors of the two endpoints.
00155   //
00156   p[0] = inp1;
00157   p[1] = inp2;
00158 }
00159 
00160 TridSketchLine::TridSketchLine( const TVector3 &x0, const TVector3 &v1, float half_length )
00161   : TridSketch( kLine, x0 )
00162   , fWidth(1.0), fStipple(-1)
00163 {
00164   // 
00165   // Defines a line using the 3-vector of the center point, the direciton vector,
00166   // and the half length.
00167   //
00168   p[0] = x0+(v1*half_length);
00169   p[1] = x0-(v1*half_length);
00170 }
00171 
00172 void TridSketchLine::DrawSelf( void ) 
00173 {
00174   // Draws a line in the current OpenGL context.
00175 
00176   glLineWidth(fWidth);
00177   if(fStipple>0) {
00178     glLineStipple(fStipple, 0xAAAA);
00179     glEnable(GL_LINE_STIPPLE);    
00180   }
00181   glBegin(GL_LINES);
00182   GlVertexTVector( p[0] );
00183   GlVertexTVector( p[1] );
00184   glEnd();
00185   glLineWidth(1.0);
00186   if(fStipple>0) {
00187     glDisable(GL_LINE_STIPPLE);    
00188   }
00189   
00190   int error;
00191   while ((error = glGetError()) != GL_NO_ERROR)  
00192     MSG("TriD",Msg::kError) << "TridSketchLine::DrawSelf.  GL error: "
00193                             << "(" << error << ")"
00194                             <<  gluErrorString(error)
00195                             << endl;
00196 
00197 }
00198 
00199 
00202 
00203 ClassImp(TridSketchPlane)
00204 
00205 TridSketchPlane::TridSketchPlane( void )
00206   : TridSketch(kPlane, TVector3())
00207 {
00208 }
00209 
00210 TridSketchPlane::TridSketchPlane( const TVector3& p1, const TVector3& p2, const TVector3& p3, const TVector3& p4 )
00211   : TridSketch( kPlane, (p1 + p2 + p3 + p4)*0.25 )
00212 {
00213   //
00214   // Defines a plane using the four corner positions.
00215   // Vertices must be given in rotational order.
00216   //
00217   p[0] = p1;
00218   p[1] = p2;
00219   p[2] = p3;
00220   p[3] = p4;
00221 }
00222 
00223 TridSketchPlane::TridSketchPlane( const TVector3& x0, 
00224                                   const TVector3& v1, float half_length, 
00225                                   const TVector3& v2, float half_width )
00226   : TridSketch( kPlane, x0 )
00227 {
00228   //
00229   // Defines a plane using the center, two width direction vectors, and half-widths.
00230   //
00231   p[0] = x0 + v1*half_length + v2*half_width;
00232   p[1] = x0 - v1*half_length + v2*half_width;
00233   p[2] = x0 - v1*half_length - v2*half_width;
00234   p[3] = x0 + v1*half_length - v2*half_width;
00235   fCenter = x0;
00236 }
00237 
00238 void TridSketchPlane::DrawSelf( void )
00239 {
00240   // Draws a plane in the current context.
00241 
00242   glBegin(GL_QUADS);
00243   GlVertexTVector(p[0]);
00244   GlVertexTVector(p[1]);
00245   GlVertexTVector(p[2]);
00246   GlVertexTVector(p[3]);
00247   glEnd();
00248 
00249 }
00250 
00253 
00254 ClassImp(TridSketchBox)
00255 
00256 TridSketchBox::TridSketchBox( void )
00257   : TridSketch( kBox, TVector3() )
00258 {
00259   //
00260   // Default constructor for a box.
00261   //
00262   cout << "TridSketchBox:: Wrong constructor!" << endl;
00263   for(int i=0;i<8;i++) {
00264     cout << "Box " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00265   }
00266 }
00267 
00268 TridSketchBox::TridSketchBox( const TVector3& p0, const TVector3& p1, const TVector3& p2, const TVector3& p3,
00269                               const TVector3& p4, const TVector3& p5, const TVector3& p6, const TVector3& p7 )
00270   : TridSketch( kBox, (p1+p2+p3+p4+p5+p6+p7)*(1.0/8.0) )
00271 {
00272   //
00273   // Defines a box using the 8 corner vertices.
00274   // Note that the corner vertices must be in order:
00275   // top-nw top-ne top-se top-sw bottom-nw bottom-ne bottom-se,bottom-sw
00276   //
00277   p[0] = p0;
00278   p[1] = p1;
00279   p[2] = p2;
00280   p[3] = p3;
00281   p[4] = p4;
00282   p[5] = p5;
00283   p[6] = p6;
00284   p[7] = p7;
00285 }
00286 
00287 TridSketchBox::TridSketchBox( const TVector3& x0, const TVector3& v1, float half_length, 
00288                               const TVector3& v2, float half_width,
00289                               const TVector3& v3, float half_depth )
00290   : TridSketch( kBox, x0 )
00291 {
00292   //
00293   // Defines a box the center, the 3 normal vectors, and a set of half-widths.
00294   //
00295   p[0] = x0 + v1*half_length + v2*half_width + v3*half_depth;
00296   p[1] = x0 + v1*half_length - v2*half_width + v3*half_depth;
00297   p[2] = x0 + v1*half_length - v2*half_width - v3*half_depth;
00298   p[3] = x0 + v1*half_length + v2*half_width - v3*half_depth;
00299   p[4] = x0 - v1*half_length + v2*half_width + v3*half_depth;
00300   p[5] = x0 - v1*half_length - v2*half_width + v3*half_depth;
00301   p[6] = x0 - v1*half_length - v2*half_width - v3*half_depth;
00302   p[7] = x0 - v1*half_length + v2*half_width - v3*half_depth;
00303 }
00304 
00305 
00306 void TridSketchBox::DrawSelf( void )
00307 {
00308   //
00309   // Draws a box in the current context.
00310   //
00311   glBegin(GL_QUADS);
00312   
00313   GlVertexTVector(p[0]);  // Top face
00314   GlVertexTVector(p[1]);
00315   GlVertexTVector(p[2]);
00316   GlVertexTVector(p[3]);
00317   
00318   GlVertexTVector(p[4]);  // Bottom face
00319   GlVertexTVector(p[5]);
00320   GlVertexTVector(p[6]);
00321   GlVertexTVector(p[7]);
00322 
00323   glEnd();
00324 
00325   glBegin(GL_QUAD_STRIP);
00326 
00327   GlVertexTVector(p[0]);  // North face
00328   GlVertexTVector(p[4]);
00329   GlVertexTVector(p[1]);
00330   GlVertexTVector(p[5]);
00331 
00332   GlVertexTVector(p[2]);  // East face
00333   GlVertexTVector(p[6]);
00334   
00335   GlVertexTVector(p[3]);  // South
00336   GlVertexTVector(p[7]);
00337   
00338   GlVertexTVector(p[0]);  // West
00339   GlVertexTVector(p[4]);
00340   
00341   glEnd();
00342   
00343   int error;
00344   while ((error = glGetError()) != GL_NO_ERROR)  
00345     MSG("TriD",Msg::kError) << "TridSketchBox::DrawSelf.  GL error: "
00346                             << "(" << error << ")"
00347                             <<  gluErrorString(error)
00348                             << endl;
00349 }
00350 
00351 
00354 
00355 ClassImp(TridSketch3Prism)
00356 
00357 TridSketch3Prism::TridSketch3Prism( void ) 
00358   : TridSketch( k3Prism, TVector3() )
00359 {
00360   //
00361   // Default constructor for a box.
00362   //
00363   cout << "TridSketch3Prism:: Wrong constructor!" << endl;
00364   for(int i=0;i<8;i++) {
00365     cout << "3Prism " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00366   }
00367 }
00368 
00369 TridSketch3Prism::TridSketch3Prism( const TVector3& p0, const TVector3& p1, const TVector3& p2, const TVector3& p3,
00370                               const TVector3& p4, const TVector3& p5  )
00371   : TridSketch( k3Prism, (p0+p1+p2+p3+p4+p5)*(1.0/6.0) )
00372 {
00373   //
00374   // Defines a box using the 8 corner vertices.
00375   // Note that the corner vertices must be in order:
00376   // top-nw top-ne top-se top-sw bottom-nw bottom-ne bottom-se,bottom-sw
00377   //
00378   p[0] = p0;
00379   p[1] = p1;
00380   p[2] = p2;
00381   p[3] = p3;
00382   p[4] = p4;
00383   p[5] = p5;
00384 }
00385 
00386 TridSketch3Prism::TridSketch3Prism( const TVector3& x0, 
00387                                     const TVector3& v1, float half_length, 
00388                                     const TVector3& v2, float half_width,
00389                                     const TVector3& v3, float half_depth,
00390                                     bool up, bool right)
00391   : TridSketch( k3Prism, x0 )
00392 {
00393   //
00394   // Defines a box the center, the 3 normal vectors, and a set of half-widths.
00395   //
00396   // Adjust which corner of the box is cut off.
00397   if(up)    half_length = -half_length;
00398   if(right) half_width  = -half_width;
00399 
00400   p[0] = x0 - v1*half_length - v2*half_width - v3*half_depth;  
00401   p[1] = x0 + v1*half_length - v2*half_width - v3*half_depth;
00402   p[2] = x0 + v1*half_length + v2*half_width - v3*half_depth;
00403 
00404   p[3] = x0 - v1*half_length - v2*half_width + v3*half_depth;
00405   p[4] = x0 + v1*half_length - v2*half_width + v3*half_depth;
00406   p[5] = x0 + v1*half_length + v2*half_width + v3*half_depth;
00407 }
00408 
00409 
00410 void TridSketch3Prism::DrawSelf( void )
00411 {
00412   //
00413   // Draws a box in the current context.
00414   //
00415   glBegin(GL_TRIANGLES);
00416   
00417   GlVertexTVector(p[0]);  // Top face
00418   GlVertexTVector(p[1]);
00419   GlVertexTVector(p[2]);
00420   
00421   GlVertexTVector(p[3]);  // Bottom face
00422   GlVertexTVector(p[4]);
00423   GlVertexTVector(p[5]);
00424 
00425   glEnd();
00426 
00427   glBegin(GL_QUAD_STRIP);
00428 
00429   GlVertexTVector(p[0]);  // North face
00430   GlVertexTVector(p[3]);
00431   GlVertexTVector(p[1]);
00432   GlVertexTVector(p[4]);
00433 
00434   GlVertexTVector(p[2]);  // East face
00435   GlVertexTVector(p[5]);
00436   
00437   GlVertexTVector(p[0]);  // South
00438   GlVertexTVector(p[3]);
00439   
00440   glEnd();
00441   
00442   int error;
00443   while ((error = glGetError()) != GL_NO_ERROR)  
00444     MSG("TriD",Msg::kError) << "TridSketch3Prism::DrawSelf.  GL error: "
00445                             << "(" << error << ")"
00446                             <<  gluErrorString(error)
00447                             << endl;
00448 }
00449 
00451 // Tube
00453 
00454 ClassImp(TridSketchTube)
00455 
00456 TridSketchTube::TridSketchTube( void )
00457   : TridSketch(kTube, TVector3() )
00458 {
00459   //
00460   // Default constructor for a box.
00461   //
00462   p = new TVector3[6];
00463   cout << "TridSketchTube:: Wrong constructor!" << endl;
00464   for(int i=0;i<8;i++) {
00465     cout << "Tube " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00466   }
00467 }
00468 
00469 
00470 TridSketchTube::TridSketchTube(  const TVector3& end1, const TVector3& end2,
00471                                  Double_t radius, Int_t nfaces, Bool_t closed )
00472   : TridSketch(kTube, (end1+end2)*0.5 )
00473 {
00474   //
00475   // Defines the center of the faces, the
00476   //
00477   fNfaces = nfaces;
00478   fClosed = closed;
00479   p = new TVector3[nfaces*2];
00480 
00481   // Find the 2 vectors normal to the length of the tube.
00482   TVector3 v = end2-end1;
00483   TVector3 n1=v.Orthogonal();
00484   TVector3 n2=v.Cross(n1);
00485 
00486   n1.SetMag(1.0);
00487   n2.SetMag(1.0);
00488 
00489   // Find the points around the ends.
00490   for(int i=0;i<fNfaces;i++) {
00491     double angle = (double)i/(double)fNfaces * 2.0*TMath::Pi();
00492     p[i]         = end1 + n1*cos(angle)*radius + n2*sin(angle)*radius;
00493     p[i+fNfaces] = end2 + n1*cos(angle)*radius + n2*sin(angle)*radius;
00494   }
00495 }
00496 
00497 
00498 void TridSketchTube::DrawSelf( void )
00499 {
00500   //
00501   // Draws a box in the current context.
00502   //
00503   if(fClosed) {
00504     // Top Face  
00505     glBegin(GL_POLYGON);
00506     for(int i=0;i<fNfaces;i++) 
00507       GlVertexTVector(p[i]); 
00508     glEnd();
00509     
00510     // Bottom face
00511     glBegin(GL_POLYGON);
00512     for(int i=fNfaces;i<fNfaces*2;i++) 
00513       GlVertexTVector(p[i]); 
00514     glEnd();
00515   }
00516 
00517   // Now do each face.
00518   glBegin(GL_QUAD_STRIP);
00519     for(int i=0;i<fNfaces+1;i++) { // Add an extra so we go all the way around.
00520       // Even and odd faces get get treated seperately.
00521       int iv1 = i%fNfaces;
00522       int iv2 = i%fNfaces + fNfaces;
00523       if((i%2)==0) {
00524         GlVertexTVector(p[iv1]);
00525         GlVertexTVector(p[iv2]);
00526       } else {
00527         GlVertexTVector(p[iv1]);
00528         GlVertexTVector(p[iv2]);
00529       }
00530     }
00531   glEnd();
00532   
00533   int error;
00534   while ((error = glGetError()) != GL_NO_ERROR)  
00535     MSG("TriD",Msg::kError) << "TridSketchTube::DrawSelf.  GL error: "
00536                             << "(" << error << ")"
00537                             <<  gluErrorString(error)
00538                             << endl;
00539 }
00540 
00542 // Ellipse
00544 
00545 ClassImp(TridSketchEllipse)
00546 
00547 TridSketchEllipse::TridSketchEllipse( void )
00548   : TridSketch( kEllipse, TVector3() )
00549 {
00550   //
00551   // Default constructor for a box.
00552   //
00553   p = new TVector3[6];
00554   cout << "TridSketchEllipse:: Wrong constructor!" << endl;
00555   for(int i=0;i<8;i++) {
00556     cout << "Ellipse " << fId << "\t" << i << "\t" << p[i].x() << "\t" << p[i].y() << "\t" << p[i].z() << endl;
00557   }
00558 }
00559 
00560 
00561 TridSketchEllipse::TridSketchEllipse( const TVector3& center, 
00562                                       const TVector3& axis1, 
00563                                       const TVector3& axis2, 
00564                                       Int_t nvertex )
00565   : TridSketch( kEllipse, center )
00566 {
00567   //
00568   // Defines the center of the faces, the
00569   //
00570   fNv = nvertex; 
00571   p = new TVector3[nvertex];
00572 
00573   // Find the points around the ends.
00574   for(int i=0;i<fNv;i++) {
00575     double angle = (double)i/(double)fNv * 2.0*TMath::Pi();
00576     p[i]         = center + axis1*cos(angle) + axis2*sin(angle);
00577   }
00578 }
00579 
00580 
00581 void TridSketchEllipse::DrawSelf( void )
00582 {
00583   //
00584   // Draws 
00585   //
00586   glBegin(GL_POLYGON);
00587   for(int i=0;i<fNv;i++) 
00588     GlVertexTVector(p[i]); 
00589   glEnd();
00590   
00591   int error;
00592   while ((error = glGetError()) != GL_NO_ERROR)  
00593     MSG("TriD",Msg::kError) << "TridSketchEllipse::DrawSelf.  GL error: "
00594                             << "(" << error << ")"
00595                             <<  gluErrorString(error)
00596                             << endl;
00597 }
00598 
00599 
00603 
00604 ClassImp(TridSketchText)
00605 
00606 TridSketchText::TridSketchText( 
00607                                const TVector3& pos, const TVector3& up, const TVector3& norm,
00608                                const char* text )
00609   : TridSketch( kText, pos ),
00610     fPosition(pos),
00611     fUp(up.Unit()),       // Normalizes
00612     fNormal(norm.Unit()), // Normalizes
00613     fScaleHoriz(1),
00614     fScaleVert(1),
00615     fThickness(0.1),  
00616     fText(text),
00617     fFont(-1),
00618     fJustify(kCenter)
00619 {
00620 }
00621 
00622 void TridSketchText::DrawSelf( void )
00623 {
00624   //
00625   // Draws a box in the current context.
00626   //
00627   glPushMatrix();
00628   
00629   // Translate.
00630   glTranslated(fPosition.x(),fPosition.y(),fPosition.z());
00631     
00632   // Rotation. By default, text is drawn 
00633   // in the x-y plane, with the normal in z and the up arrow towards y.
00634   TVector3 stdnorm(0,0,1);
00635   TVector3 stdup  (0,1,0);
00636 
00637   // Rotate so that the normal is in the correct position.
00638   // Special case: flip by 180:
00639   TVector3 rot;
00640   Double_t ang1;
00641   if(fNormal == -kv_z) {
00642     rot = TVector3(0,1,0);
00643     ang1 = 180.; 
00644   } else {
00645     //rot = stdnorm.Cross(fNormal).Unit();
00646     //ang1 = acos(stdnorm.Dot(fNormal))*57.295779513;
00647     rot = stdnorm.Cross(fNormal);
00648     ang1= asin(rot.Mag())*57.295779513;
00649     if(ang1!=0) rot.SetMag(1.0);
00650   }
00651 
00652   if(ang1!=0)
00653     stdup.Rotate(ang1*0.01745329252,rot);  // stdup is y rotated into the new position.
00654 
00655   double ang2 = stdup.Angle(fUp)*57.295779513;
00656 
00657   // Rotate so that the Up vector is correct.
00658   if(ang2!=0)
00659     glRotated(ang2, fNormal.x(), fNormal.y(), fNormal.z() );
00660 
00661   // Rotate for normal to be correct.
00662   if(ang1!=0)
00663     glRotated(ang1, rot.x(), rot.y(), rot.z() );
00664   
00665   // Stretch.
00666   glScaled(fScaleHoriz, fScaleVert, 1.0);
00667 
00668   // Move to correct local Z
00669   glTranslated(0.,0.,-1.);
00670   
00671   // Set options
00672   int oldFont = glfGetCurrentFont();
00673   if(fFont>0) glfSetCurrentFont(fFont);
00674 
00675   glfSetSymbolDepth(fThickness);
00676   glfStringCentering(true);
00677 
00678   float minx, miny, maxx, maxy;
00679   glfGetStringBounds(const_cast<char*>(fText.Data()), &minx, &miny, &maxx, &maxy);
00680   
00681   // Adjust for stupidities in glf
00682   minx -= 1.0;
00683   maxx -= 1.0;
00684 
00685   float halfwidth =  (minx+maxx)*0.5;
00686   float halfheight = (-miny+maxy)*0.5;
00687 
00688   // Default: center.
00689   float movex = 0; //halfwidth;
00690   float movey = 0;
00691 
00692   if(fJustify & kJustifyLeft)   movex  = -halfwidth + minx;
00693   if(fJustify & kJustifyRight)  movex  = halfwidth - minx;
00694   if(fJustify & kJustifyTop)    movey += halfheight;
00695   if(fJustify & kJustifyBottom) movey -= halfheight;
00696 
00697   glTranslatef(-movex,-movey,0.0f);
00698   /*
00699     // Draw bounding box.
00700   glPushMatrix();
00701   glBegin(GL_LINE_LOOP);
00702   glColor4f(fColor.x(),fColor.y(),fColor.z(),fTransparency);
00703   glVertex3f(minx, miny, 1.0 );
00704   glVertex3f(minx, maxy, 1.0 );
00705   glVertex3f(maxx, maxy, 1.0 );
00706   glVertex3f(maxx, miny, 1.0 );
00707   //glVertex3f(minx, miny, 1.0 );
00708   glEnd();
00709   glPopMatrix();
00710   */
00711 
00712   // Draw.
00713   glfDraw3DSolidString(const_cast<char*>(fText.Data()));
00714 
00715   glfSetCurrentFont(oldFont);
00716 
00717   // Revert.
00718   glPopMatrix();
00719 
00720   int error;
00721   while ((error = glGetError()) != GL_NO_ERROR)  
00722     MSG("TriD",Msg::kError) << "TridSketchText::DrawSelf.  GL error: "
00723                             << "(" << error << ")"
00724                             <<  gluErrorString(error)
00725                             << endl;
00726 
00727    
00728 }
00729 

Generated on Mon Feb 15 11:07:46 2010 for loon by  doxygen 1.3.9.1