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/G4OpenGLXViewer.cc

    r1343 r1346  
    2525//
    2626//
    27 // $Id: G4OpenGLXViewer.cc,v 1.55 2009/05/13 10:28:00 lgarnier Exp $
     27// $Id: G4OpenGLXViewer.cc,v 1.56 2010/11/10 17:57:16 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    3838#include "G4VViewer.hh"
    3939#include "G4OpenGLSceneHandler.hh"
    40 #include <GL/glu.h>
    4140
    4241#include "G4OpenGLFontBaseStore.hh"
     
    5049#include "G4Normal3D.hh"
    5150#include "G4StateManager.hh"
     51#include "G4VisManager.hh"
    5252
    5353#include <X11/Xatom.h>
     
    197197    if (!cmap) {
    198198      fViewId = -1;  // This flags an error.
    199       G4cerr <<
    200    "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
    201              << G4endl;
     199      if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
     200        G4cerr <<
     201  "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
     202               << G4endl;
    202203      return;
    203204    }
    204     G4cout << "Got standard cmap" << G4endl;
     205    if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
     206      G4cout << "Got standard cmap" << G4endl;
    205207  } else {
    206208    cmap = XCreateColormap (dpy,
     
    208210                            vi -> visual,
    209211                            AllocNone);
    210     G4cout << "Created own cmap" << G4endl;
     212    if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
     213      G4cout << "Created own cmap" << G4endl;
    211214  }
    212215
    213216  if (!cmap) {
    214217    fViewId = -1;  // This flags an error.
    215     G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
    216          << G4endl;
     218    if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
     219      G4cout << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
     220             << G4endl;
    217221    return;
    218222  }
     
    250254    size_hints->flags |= PPosition;
    251255  }
    252   G4cout << "Window name: " << fName << G4endl;
     256  if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations)
     257    G4cout << "Window name: " << fName << G4endl;
    253258  strncpy (charViewName, fName, 100);
    254259  char *window_name = charViewName;
     
    337342}
    338343
     344void G4OpenGLXViewer::drawText(const char * textString,int x,int y,int z, int size){
     345 
     346  CreateFontLists ();
     347  // gl2ps or GL window ?
     348  if (! drawGl2psText(textString,size)) {
     349
     350    G4int font_base = G4OpenGLFontBaseStore::GetFontBase(this,size);
     351    if (font_base < 0) {
     352      static G4int callCount = 0;
     353      ++callCount;
     354      if (callCount <= 10 || callCount%100 == 0) {
     355        G4cout <<
     356          "G4OpenGLSceneHandler::AddPrimitive (const G4Text&) call count "
     357               << callCount <<
     358          "\n  No fonts available."
     359          "\n  Called with text \""
     360               << textString
     361               << "\"\n  at "
     362               << "x:"<< x
     363               << "y:"<< y
     364               << "z:"<< z
     365               << ", size " << size
     366          //               << ", offsets " << text.GetXOffset () << ", " << text.GetYOffset ()
     367               << G4endl;
     368      }
     369      return;
     370    }
     371    // No action on offset or layout at present.
     372    glPushAttrib(GL_LIST_BIT);
     373    glListBase(font_base);
     374    glCallLists(strlen(textString), GL_UNSIGNED_BYTE, (GLubyte *)textString);
     375    glPopAttrib();
     376  }
     377}
     378
     379
    339380G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene):
    340381G4VViewer (scene, -1),
Note: See TracChangeset for help on using the changeset viewer.