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

before tag

Location:
trunk/source/visualization/OpenGL/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenGL/src/CVS/Entries

    r1343 r1346  
    1 /G4OpenGLViewer.cc/1.63/Tue Oct  5 15:45:19 2010//
    2 /G4OpenGLBitMapStore.cc/1.5/Mon Jan 19 16:53:42 2009//
    3 /G4OpenGLFontBaseStore.cc/1.4/Mon Jan 19 16:53:42 2009//
    4 /G4OpenGLImmediateQt.cc/1.6/Wed Feb  4 16:48:41 2009//
    5 /G4OpenGLImmediateQtViewer.cc/1.22/Wed Jun 23 13:29:23 2010//
    6 /G4OpenGLImmediateSceneHandler.cc/1.35/Thu Jun  3 20:35:19 2010//
    7 /G4OpenGLImmediateViewer.cc/1.10/Wed Feb  4 16:48:41 2009//
    8 /G4OpenGLImmediateWin32.cc/1.13/Wed May 20 09:58:10 2009//
    9 /G4OpenGLImmediateWin32Viewer.cc/1.19/Wed May 20 10:19:51 2009//
    10 /G4OpenGLImmediateX.cc/1.15/Wed Feb  4 16:48:41 2009//
    11 /G4OpenGLImmediateXViewer.cc/1.19/Wed Feb  4 16:48:41 2009//
    12 /G4OpenGLImmediateXm.cc/1.15/Wed Feb  4 16:48:41 2009//
    13 /G4OpenGLImmediateXmViewer.cc/1.21/Wed Apr  8 16:55:44 2009//
    14 /G4OpenGLQtExportDialog.cc/1.9/Fri Oct 24 14:17:10 2008//
    15 /G4OpenGLQtMovieDialog.cc/1.8/Fri Oct 24 13:49:19 2008//
    16 /G4OpenGLQtViewer.cc/1.55/Fri Oct  8 10:07:31 2010//
    17 /G4OpenGLSceneHandler.cc/1.59/Sun May 30 09:53:05 2010//
    18 /G4OpenGLStoredQt.cc/1.10/Mon Jan 19 16:26:40 2009//
    19 /G4OpenGLStoredQtViewer.cc/1.32/Mon Nov  8 11:03:16 2010//
    20 /G4OpenGLStoredSceneHandler.cc/1.44/Sat Nov  6 12:09:41 2010//
    21 /G4OpenGLStoredViewer.cc/1.29/Wed Oct  6 10:05:52 2010//
    22 /G4OpenGLStoredWin32.cc/1.15/Mon Jan 19 16:53:42 2009//
    23 /G4OpenGLStoredWin32Viewer.cc/1.22/Wed May 20 13:19:09 2009//
    24 /G4OpenGLStoredX.cc/1.15/Mon Jan 19 16:53:42 2009//
    25 /G4OpenGLStoredXViewer.cc/1.27/Thu Jun  3 08:26:55 2010//
    26 /G4OpenGLStoredXm.cc/1.12/Mon Jan 19 16:53:42 2009//
    27 /G4OpenGLStoredXmViewer.cc/1.26/Fri Apr 30 13:18:32 2010//
    28 /G4OpenGLTransform3D.cc/1.9/Mon Jan 19 16:53:42 2009//
    29 /G4OpenGLViewerMessenger.cc/1.21/Sun Nov  7 10:31:26 2010//
    30 /G4OpenGLWin32Viewer.cc/1.20/Wed May 20 13:19:09 2009//
    31 /G4OpenGLXViewer.cc/1.55/Wed May 13 10:28:00 2009//
    32 /G4OpenGLXmBox.cc/1.8/Wed Feb  4 16:48:41 2009//
    33 /G4OpenGLXmConvenienceRoutines.cc/1.13/Wed Feb  4 16:48:41 2009//
    34 /G4OpenGLXmFourArrowButtons.cc/1.7/Wed Feb  4 16:48:41 2009//
    35 /G4OpenGLXmFramedBox.cc/1.8/Wed Feb  4 16:48:41 2009//
    36 /G4OpenGLXmMainMenubarCallbacks.cc/1.18/Tue Oct 20 12:47:45 2009//
    37 /G4OpenGLXmPanningCallbacks.cc/1.12/Tue Nov  3 10:21:49 2009//
    38 /G4OpenGLXmPushButton.cc/1.8/Wed Feb  4 16:48:41 2009//
    39 /G4OpenGLXmRadioButton.cc/1.8/Wed Feb  4 16:48:41 2009//
    40 /G4OpenGLXmRotationCallbacks.cc/1.17/Mon Jan 19 16:53:42 2009//
    41 /G4OpenGLXmSeparator.cc/1.7/Wed Feb  4 16:48:41 2009//
    42 /G4OpenGLXmSliderBar.cc/1.8/Mon Jan 19 16:53:42 2009//
    43 /G4OpenGLXmStyleCallbacks.cc/1.15/Mon Jan 19 16:53:42 2009//
    44 /G4OpenGLXmTextField.cc/1.9/Wed Feb  4 16:48:41 2009//
    45 /G4OpenGLXmTopLevelShell.cc/1.7/Wed Feb  4 16:48:41 2009//
    46 /G4OpenGLXmVWidgetComponent.cc/1.6/Mon Jan 19 16:53:42 2009//
    47 /G4OpenGLXmVWidgetContainer.cc/1.7/Fri Mar 13 09:50:03 2009//
    48 /G4OpenGLXmVWidgetObject.cc/1.7/Wed Feb  4 16:48:41 2009//
    49 /G4OpenGLXmVWidgetShell.cc/1.6/Mon Jan 19 16:53:42 2009//
    50 /G4OpenGLXmViewer.cc/1.31/Wed May 13 10:28:00 2009//
    51 /G4OpenGLXmViewerMessenger.cc/1.5/Mon Jan 19 16:53:42 2009//
    52 /G4OpenGLXmWindowHandlingCallbacks.cc/1.11/Mon Nov  8 11:03:16 2010//
     1/G4OpenGLBitMapStore.cc/1.5/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     2/G4OpenGLFontBaseStore.cc/1.4/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     3/G4OpenGLImmediateQt.cc/1.6/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     4/G4OpenGLImmediateQtViewer.cc/1.22/Wed Jun 23 13:29:23 2010//Tgeant4-09-04-ref-00
     5/G4OpenGLImmediateSceneHandler.cc/1.35/Thu Jun  3 20:35:19 2010//Tgeant4-09-04-ref-00
     6/G4OpenGLImmediateViewer.cc/1.10/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     7/G4OpenGLImmediateWin32.cc/1.13/Wed May 20 09:58:10 2009//Tgeant4-09-04-ref-00
     8/G4OpenGLImmediateWin32Viewer.cc/1.19/Wed May 20 10:19:51 2009//Tgeant4-09-04-ref-00
     9/G4OpenGLImmediateX.cc/1.15/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     10/G4OpenGLImmediateXViewer.cc/1.19/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     11/G4OpenGLImmediateXm.cc/1.15/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     12/G4OpenGLImmediateXmViewer.cc/1.21/Wed Apr  8 16:55:44 2009//Tgeant4-09-04-ref-00
     13/G4OpenGLQtExportDialog.cc/1.9/Fri Oct 24 14:17:10 2008//Tgeant4-09-04-ref-00
     14/G4OpenGLQtMovieDialog.cc/1.8/Fri Oct 24 13:49:19 2008//Tgeant4-09-04-ref-00
     15/G4OpenGLQtViewer.cc/1.55/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     16/G4OpenGLSceneHandler.cc/1.59/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     17/G4OpenGLStoredQt.cc/1.10/Mon Jan 19 16:26:40 2009//Tgeant4-09-04-ref-00
     18/G4OpenGLStoredQtViewer.cc/1.32/Mon Dec  6 16:50:27 2010//Tgeant4-09-04-ref-00
     19/G4OpenGLStoredSceneHandler.cc/1.46/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     20/G4OpenGLStoredViewer.cc/1.29/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     21/G4OpenGLStoredWin32.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     22/G4OpenGLStoredWin32Viewer.cc/1.22/Wed May 20 13:19:09 2009//Tgeant4-09-04-ref-00
     23/G4OpenGLStoredX.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     24/G4OpenGLStoredXViewer.cc/1.27/Thu Jun  3 08:26:55 2010//Tgeant4-09-04-ref-00
     25/G4OpenGLStoredXm.cc/1.12/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     26/G4OpenGLStoredXmViewer.cc/1.26/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     27/G4OpenGLTransform3D.cc/1.9/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     28/G4OpenGLViewer.cc/1.63/dummy timestamp from new-entry//Tgeant4-09-04-ref-00
     29/G4OpenGLViewerMessenger.cc/1.21/Sun Nov  7 10:31:26 2010//Tgeant4-09-04-ref-00
     30/G4OpenGLWin32Viewer.cc/1.20/Wed May 20 13:19:09 2009//Tgeant4-09-04-ref-00
     31/G4OpenGLXViewer.cc/1.56/Result of merge//Tgeant4-09-04-ref-00
     32/G4OpenGLXmBox.cc/1.8/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     33/G4OpenGLXmConvenienceRoutines.cc/1.13/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     34/G4OpenGLXmFourArrowButtons.cc/1.7/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     35/G4OpenGLXmFramedBox.cc/1.8/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     36/G4OpenGLXmMainMenubarCallbacks.cc/1.18/Tue Oct 20 12:47:45 2009//Tgeant4-09-04-ref-00
     37/G4OpenGLXmPanningCallbacks.cc/1.12/Tue Nov  3 10:21:49 2009//Tgeant4-09-04-ref-00
     38/G4OpenGLXmPushButton.cc/1.8/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     39/G4OpenGLXmRadioButton.cc/1.8/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     40/G4OpenGLXmRotationCallbacks.cc/1.17/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     41/G4OpenGLXmSeparator.cc/1.7/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     42/G4OpenGLXmSliderBar.cc/1.8/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     43/G4OpenGLXmStyleCallbacks.cc/1.15/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     44/G4OpenGLXmTextField.cc/1.9/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     45/G4OpenGLXmTopLevelShell.cc/1.7/Wed Feb  4 16:48:41 2009//Tgeant4-09-04-ref-00
     46/G4OpenGLXmVWidgetComponent.cc/1.6/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     47/G4OpenGLXmVWidgetContainer.cc/1.7/Fri Mar 13 09:50:03 2009//Tgeant4-09-04-ref-00
     48/G4OpenGLXmVWidgetObject.cc/1.7/Mon Dec  6 17:36:26 2010//Tgeant4-09-04-ref-00
     49/G4OpenGLXmVWidgetShell.cc/1.6/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     50/G4OpenGLXmViewer.cc/1.31/Wed May 13 10:28:00 2009//Tgeant4-09-04-ref-00
     51/G4OpenGLXmViewerMessenger.cc/1.5/Mon Jan 19 16:53:42 2009//Tgeant4-09-04-ref-00
     52/G4OpenGLXmWindowHandlingCallbacks.cc/1.11/Wed May 13 10:28:00 2009//Tgeant4-09-04-ref-00
    5353D
  • trunk/source/visualization/OpenGL/src/CVS/Tag

    r1331 r1346  
    1 Ngeant4-09-04-beta-01
     1Ngeant4-09-04-ref-00
  • trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r1340 r1346  
    195195  if (!fContextMenu)
    196196    createPopupMenu();
     197
     198  //dummy call to init Text display list
     199  drawText("",0,0,0,10);
    197200
    198201}
     
    274277
    275278
     279void G4OpenGLQtViewer::drawText(const char * textString,int x,int y,int z, int size) {
     280  if (!fWindow)
     281    return;
     282  QFont font = QFont();
     283  font.setPointSize(size);
     284
     285  // gl2ps or GL window ?
     286  int fontsize=font.pixelSize();
     287  if(font.pointSize() > fontsize) {
     288    fontsize = font.pointSize();
     289  }
     290#ifdef G4DEBUG_VIS_OGL
     291    printf("G4OpenGLQtViewer::drawText :: renderText.............. \n");
     292#endif
     293  if (! drawGl2psText(textString,fontsize)) {
     294    fWindow->renderText(x,y,z, textString,font);
     295  }
     296}
     297
     298
     299
    276300/**
    277301   Create a popup menu for the widget. This menu is activated by right-mouse click
     
    14741498{
    14751499  glFlush ();
    1476 
    14771500  // L. Garnier 10/2009 : Not necessary and cause problems on mac OS X 10.6
    14781501  //  fWindow->swapBuffers ();
     
    15171540    // try to addapt speed move/rotate looking to drawing speed
    15181541    float correctionFactor = 5;
     1542    float globalTime = 0;
     1543    float globalRun = 0;
    15191544    while (fAutoMove) {
    15201545      if ( lastMoveTime.elapsed () >= (int)(1000/fNbMaxFramesPerSec)) {
     
    15521577          moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
    15531578        }
     1579        //#ifdef G4DEBUG_VIS_OGL
     1580        globalTime += (float)lastMoveTime.elapsed ();
     1581        globalRun +=1;
     1582        printf("G4OpenGLQtViewer::CreateMainWindow :: time/per run :%f run:%f %f\n",globalTime/globalRun,globalRun,globalTime);
     1583        //#endif
    15541584        lastMoveTime.start();
    15551585      }
  • 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
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc

    r1343 r1346  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.44 2010/11/06 12:09:41 allison Exp $
     27// $Id: G4OpenGLStoredSceneHandler.cc,v 1.46 2010/11/10 17:11:20 allison Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    105105  if (fMemoryForDisplayLists) {
    106106    fDisplayListId = glGenLists (1);
     107#ifdef G4DEBUG_VIS_OGL
     108    printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->glGenList(1) : %d readyForTranscient:%d\n",fDisplayListId,fReadyForTransients);
     109#endif
    107110    if (glGetError() == GL_OUT_OF_MEMORY ||
    108         fDisplayListId > fDisplayListLimit + fDisplayListBase) {
     111        fDisplayListId > fDisplayListLimit) {
    109112      G4cout <<
    110         "********************* WARNING! ********************"
    111         "\n  Display list limit reached in OpenGL."
    112         "\n  Continuing drawing in IMMEDIATE MODE."
    113         "\n  Current limit: "
    114              << fDisplayListLimit <<
    115         ".  Change with \"/vis/ogl/set/displayListLimit\"."
    116         "\n***************************************************"
     113  "********************* WARNING! ********************"
     114  "\n*  Display list limit reached in OpenGL."
     115  "\n*  Continuing drawing WITHOUT STORING. Scene only partially refreshable."
     116  "\n*  Current limit: " << fDisplayListLimit <<
     117  ".  Change with \"/vis/ogl/set/displayListLimit\"."
     118  "\n***************************************************"
    117119             << G4endl;
    118120      fMemoryForDisplayLists = false;
     
    128130      to.fStartTime = pVA->GetStartTime();
    129131      to.fEndTime = pVA->GetEndTime();
     132#ifdef G4DEBUG_VIS_OGL
     133    printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->fTOList puch_back\n");
     134#endif
    130135      fTOList.push_back(to);
    131136      glDrawBuffer (GL_FRONT);
     137#ifdef G4DEBUG_VIS_OGL
     138    printf("+1\n");
     139#endif
    132140      glPushMatrix();
    133141      G4OpenGLTransform3D oglt (*fpObjectTransformation);
     
    139147      PO po(fDisplayListId, *fpObjectTransformation);
    140148      po.fPickName = fPickName;
     149#ifdef G4DEBUG_VIS_OGL
     150    printf("G4OpenGLStoredSceneHandler::AddPrimitivePreamble ->fPOList puch_back\n");
     151#endif
    141152      fPOList.push_back(po);
    142153      glNewList (fDisplayListId, GL_COMPILE);
     
    145156  } else {
    146157    glDrawBuffer (GL_FRONT);
     158#ifdef G4DEBUG_VIS_OGL
     159    printf("+2\n");
     160#endif
    147161    glPushMatrix();
    148162    G4OpenGLTransform3D oglt (*fpObjectTransformation);
     
    155169    // coordinates...
    156170    glMatrixMode (GL_PROJECTION);
     171#ifdef G4DEBUG_VIS_OGL
     172    printf("+3\n");
     173#endif
    157174    glPushMatrix();
    158175    glLoadIdentity();
    159176    glOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
    160177    glMatrixMode (GL_MODELVIEW);
     178#ifdef G4DEBUG_VIS_OGL
     179    printf("+4\n");
     180#endif
    161181    glPushMatrix();
    162182    glLoadIdentity();
     
    172192    // Pop current 3D world matrices back again...
    173193    glMatrixMode (GL_PROJECTION);
     194#ifdef G4DEBUG_VIS_OGL
     195    printf("-1\n");
     196#endif
    174197    glPopMatrix();
    175198    glMatrixMode (GL_MODELVIEW);
     199#ifdef G4DEBUG_VIS_OGL
     200    printf("-2\n");
     201#endif
    176202    glPopMatrix();
    177203  }
     
    194220  }
    195221  if (fReadyForTransients || !fMemoryForDisplayLists) {
     222#ifdef G4DEBUG_VIS_OGL
     223    printf("-3\n");
     224#endif
    196225    glPopMatrix();
    197226    glFlush ();
     
    203232void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
    204233{
     234#ifdef G4DEBUG_VIS_OGL
     235    printf("G4OpenGLStoredSceneHandler::AddPrimitive polyline\n");
     236    //    if (glIsList(7)) return;
     237#endif
    205238  AddPrimitivePreamble(polyline);
    206239  G4OpenGLSceneHandler::AddPrimitive(polyline);
     
    210243void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
    211244{
     245#ifdef G4DEBUG_VIS_OGL
     246    printf("G4OpenGLStoredSceneHandler::AddPrimitive polymarker\n");
     247    if (glIsList(7)) return;
     248#endif
    212249  AddPrimitivePreamble(polymarker);
    213250  G4OpenGLSceneHandler::AddPrimitive(polymarker);
     
    220257  // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
    221258  // gets into the display list
     259#ifdef G4DEBUG_VIS_OGL
     260    printf("G4OpenGLStoredSceneHandler::AddPrimitive Text\n");
     261#endif
    222262  AddPrimitivePreamble(text);
    223263  G4OpenGLSceneHandler::AddPrimitive(text);
     
    227267void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
    228268{
     269#ifdef G4DEBUG_VIS_OGL
     270    printf("G4OpenGLStoredSceneHandler::AddPrimitive circle\n");
     271#endif
    229272  AddPrimitivePreamble(circle);
    230273  G4OpenGLSceneHandler::AddPrimitive(circle);
     
    234277void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
    235278{
     279#ifdef G4DEBUG_VIS_OGL
     280    printf("G4OpenGLStoredSceneHandler::AddPrimitive square\n");
     281#endif
    236282  AddPrimitivePreamble(square);
    237283  G4OpenGLSceneHandler::AddPrimitive(square);
     
    250296  // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
    251297  // gets into the display list
     298#ifdef G4DEBUG_VIS_OGL
     299    printf("G4OpenGLStoredSceneHandler::AddPrimitive polyhedron\n");
     300#endif
    252301  AddPrimitivePreamble(polyhedron);
    253302  G4OpenGLSceneHandler::AddPrimitive(polyhedron);
     
    260309  // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still
    261310  // gets into the display list
     311#ifdef G4DEBUG_VIS_OGL
     312    printf("G4OpenGLStoredSceneHandler::AddPrimitive nurbs\n");
     313#endif
    262314  AddPrimitivePreamble(nurbs);
    263315  G4OpenGLSceneHandler::AddPrimitive(nurbs);
     
    301353  // Make a List which calls the other lists.
    302354  fTopPODL = glGenLists (1);
     355#ifdef G4DEBUG_VIS_OGL
     356    printf("G4OpenGLStoredSceneHandler::EndModeling ->glGenList(1) fTopPODL:%d\n",fTopPODL);
     357#endif
    303358  if (glGetError() == GL_OUT_OF_MEMORY) {  // Could pre-allocate?
    304359    G4cout <<
     
    309364    glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
    310365      for (size_t i = 0; i < fPOList.size (); i++) {
     366#ifdef G4DEBUG_VIS_OGL
     367    printf("+5\n");
     368#endif
    311369        glPushMatrix();
    312370        G4OpenGLTransform3D oglt (fPOList[i].fTransform);
     
    315373          glLoadName(fPOList[i].fPickName);
    316374        glCallList (fPOList[i].fDisplayListId);
     375#ifdef G4DEBUG_VIS_OGL
     376    printf("-4\n");
     377#endif
    317378        glPopMatrix();
    318379      }
     
    337398void G4OpenGLStoredSceneHandler::ClearStore () {
    338399
     400  //G4cout << "G4OpenGLStoredSceneHandler::ClearStore" << G4endl;
     401
    339402  G4VSceneHandler::ClearStore ();  // Sets need kernel visit, etc.
    340403
     
    355418  fTOList.clear ();
    356419
    357   fDisplayListBase = fDisplayListId;
    358420  fMemoryForDisplayLists = true;
    359 
    360421}
    361422
    362423void G4OpenGLStoredSceneHandler::ClearTransientStore () {
     424
     425  //G4cout << "G4OpenGLStoredSceneHandler::ClearTransientStore" << G4endl;
    363426
    364427  G4VSceneHandler::ClearTransientStore ();
     
    369432  fTOList.clear ();
    370433
    371   fDisplayListBase = fDisplayListId;
    372434  fMemoryForDisplayLists = true;
    373435
     
    476538G4bool G4OpenGLStoredSceneHandler::fMemoryForDisplayLists = true;
    477539G4int  G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000;
    478 G4int  G4OpenGLStoredSceneHandler::fDisplayListBase = 0;
    479 
    480 #endif
     540
     541#endif
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredViewer.cc

    r1340 r1346  
    155155    }
    156156
    157     if (fG4OpenGLStoredSceneHandler.fTopPODL)
     157    if (fG4OpenGLStoredSceneHandler.fTopPODL) {
    158158      glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
    159 
     159#ifdef G4DEBUG_VIS_OGL
     160      printf("fTopPODL :%d\n",fG4OpenGLStoredSceneHandler.fTopPODL);
     161#endif
     162    }
     163#ifdef G4DEBUG_VIS_OGL
     164    printf("TOList :");
     165#endif
    160166    for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
    161167#ifdef G4DEBUG_VIS_OGL
     
    180186           bsf * c.GetBlue() + (1. - bsf) * bg.GetBlue());
    181187        glCallList (to.fDisplayListId);
     188#ifdef G4DEBUG_VIS_OGL
     189        printf("%d ",to.fDisplayListId);
     190#endif
    182191        glPopMatrix();
    183192      }
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc

    r1343 r1346  
    6666  CreateGLXContext (vi_stored);
    6767  CreateMainWindow ();
    68   CreateFontLists ();
     68  //  CreateFontLists ();
    6969
    7070  InitializeGLView ();
  • trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc

    r1340 r1346  
    388388  DrawView();
    389389  GLint hits = glRenderMode(GL_RENDER);
     390#ifdef G4DEBUG_VIS_OGL
     391  printf("G4OpenGLViewer::Pick °_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_°_\n");
     392#endif
    390393  if (hits < 0)
    391394    G4cout << "Too many hits.  Zoom in to reduce overlaps." << G4endl;
     
    619622
    620623
     624/* Draw Gl2Ps text if needed
     625   return true if it is draw
     626 */
     627bool G4OpenGLViewer::drawGl2psText(const char * textString, int size) {
     628
     629  if (!fGL2PSAction) return false;
     630  if (fGL2PSAction->fileWritingEnabled()) {
     631    gl2psText(textString,"Times-Roman",size);
     632    return true;
     633  }
     634  return false;
     635}
     636
     637
    621638bool G4OpenGLViewer::printGl2PS() {
    622639
     
    646663  // http://www.songho.ca/opengl/gl_fbo.html
    647664
     665  NeedKernelVisit ();
    648666  ResizeGLView();
    649667  if (fGL2PSAction->enableFileWriting()) {
  • 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.