Changeset 1346 for trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
- Timestamp:
- Dec 22, 2010, 11:33:38 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r1343 r1346 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.cc,v 1.5 5 2009/05/13 10:28:00 lgarnierExp $27 // $Id: G4OpenGLXViewer.cc,v 1.56 2010/11/10 17:57:16 allison Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 38 38 #include "G4VViewer.hh" 39 39 #include "G4OpenGLSceneHandler.hh" 40 #include <GL/glu.h>41 40 42 41 #include "G4OpenGLFontBaseStore.hh" … … 50 49 #include "G4Normal3D.hh" 51 50 #include "G4StateManager.hh" 51 #include "G4VisManager.hh" 52 52 53 53 #include <X11/Xatom.h> … … 197 197 if (!cmap) { 198 198 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; 202 203 return; 203 204 } 204 G4cout << "Got standard cmap" << G4endl; 205 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 206 G4cout << "Got standard cmap" << G4endl; 205 207 } else { 206 208 cmap = XCreateColormap (dpy, … … 208 210 vi -> visual, 209 211 AllocNone); 210 G4cout << "Created own cmap" << G4endl; 212 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 213 G4cout << "Created own cmap" << G4endl; 211 214 } 212 215 213 216 if (!cmap) { 214 217 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; 217 221 return; 218 222 } … … 250 254 size_hints->flags |= PPosition; 251 255 } 252 G4cout << "Window name: " << fName << G4endl; 256 if (G4VisManager::GetVerbosity() >= G4VisManager::confirmations) 257 G4cout << "Window name: " << fName << G4endl; 253 258 strncpy (charViewName, fName, 100); 254 259 char *window_name = charViewName; … … 337 342 } 338 343 344 void 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 339 380 G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene): 340 381 G4VViewer (scene, -1),
Note: See TracChangeset
for help on using the changeset viewer.