Ignore:
Timestamp:
Dec 22, 2010, 11:33:38 AM (13 years ago)
Author:
garnier
Message:

before tag

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc

    r1343 r1346  
    4646#include "G4OpenGLSceneHandler.hh"
    4747#include "G4OpenGLViewer.hh"
    48 #include "G4OpenGLFontBaseStore.hh"
     48#include "G4OpenGLQtViewer.hh"
     49#include "G4OpenGLXViewer.hh"
    4950#include "G4OpenGLTransform3D.hh"
    5051#include "G4Point3D.hh"
     
    268269  G4String textString = text.GetText();
    269270
    270   G4int font_base = G4OpenGLFontBaseStore::GetFontBase(fpViewer,size);
    271   if (font_base < 0) {
    272     static G4int callCount = 0;
    273     ++callCount;
    274     if (callCount <= 10 || callCount%100 == 0) {
    275       G4cout <<
    276         "G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count "
    277              << callCount <<
    278         "\n  No fonts available."
    279         "\n  Called with text \""
    280              << text.GetText ()
    281              << "\"\n  at " << position
    282              << ", size " << size
    283              << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()
    284              << ", type " << G4int(sizeType)
    285              << ", colour " << c
    286              << G4endl;
    287     }
    288     return;
    289   }
    290271  const char* textCString = textString.c_str();
     272  GLfloat color[4]; /* Ask OpenGL for the current color */
     273  glGetFloatv(GL_CURRENT_COLOR, color);
    291274  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    292275  glDisable (GL_DEPTH_TEST);
     
    294277 
    295278  glRasterPos3d(position.x(),position.y(),position.z());
    296   // No action on offset or layout at present.
    297    glPushAttrib(GL_LIST_BIT);
    298    glListBase(font_base);
    299    glCallLists(strlen(textCString), GL_UNSIGNED_BYTE, (GLubyte *)textCString);
    300    glPopAttrib();
     279  //FIXME : We should do a virtual method drawText in all viewers
     280  // Not the same way to draw text in Qt
     281#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
     282  G4OpenGLQtViewer* pQtViewer = dynamic_cast<G4OpenGLQtViewer*>(fpViewer);
     283  if (pQtViewer) {
     284    pQtViewer->drawText(textCString,position.x(),position.y(),position.z(),size);
     285  }
     286#endif
     287
     288  // nor for X
     289#ifdef G4VIS_BUILD_OPENGLX_DRIVER
     290  G4OpenGLXViewer* pXViewer = dynamic_cast<G4OpenGLXViewer*>(fpViewer);
     291  if (pXViewer) {
     292
     293    pXViewer->drawText(textCString,position.x(),position.y(),position.z(),size);
     294  }
     295#endif
     296  glColor3d (color[0], color[1], color[2]);
     297
    301298}
    302299
Note: See TracChangeset for help on using the changeset viewer.