Ignore:
Timestamp:
Nov 5, 2010, 3:45:55 PM (14 years ago)
Author:
garnier
Message:

update ti head

Location:
trunk/source/visualization/OpenGL
Files:
15 edited

Legend:

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

    r1337 r1340  
    44/Doxyfile/1.4/Mon Jul 12 14:53:12 2010//
    55/GNUmakefile/1.13/Thu Sep 30 06:16:41 2010//
    6 /History/1.180/Thu Sep 30 11:54:25 2010//
    76/sources.cmake/1.1/Wed Sep 29 19:12:14 2010//
     7/History/1.187/Fri Nov  5 10:16:45 2010//
  • trunk/source/visualization/OpenGL/GNUmakefile

    r1337 r1340  
    1111
    1212# For debug mode
    13 # CPPFLAGS += -DG4DEBUG_VIS_OGL
     13CPPFLAGS += -DG4DEBUG_VIS_OGL
    1414
    1515GLOBLIBS  = libG4vis_management.lib libG4modeling.lib libG4gl2ps.lib
  • trunk/source/visualization/OpenGL/History

    r1337 r1340  
    1 $Id: History,v 1.180 2010/06/23 13:29:23 lgarnier Exp $
     1$Id: History,v 1.187 2010/11/05 06:25:23 allison Exp $
    22-------------------------------------------------------------------
    33
     
    1717     * Reverse chronological order (last date on top), please *
    1818     ----------------------------------------------------------
     19
     205th November 2010  John Allison
     21- G4OpenGLStoredSceneHandler, G4OpenGLViewerMessenger:
     22  o Introduced a display list limit to avoid memory exhaustion.
     23  o Introduced /vis/ogl/set/displayListLimit.
     24
     258th October 2010  Laurent Garnier
     26- G4OpenGQtViewer.cc:
     27  o Add menu for changing text color, default color, background color
     28  o Toogle projection now call directly command instead of redefinding it
     29
     306th October 2010  John Allison  (opengl-V09-03-08 with co-working tags...)
     31- Co-working tags: interfaces-V09-03-12 + config-V09-03-08
     32- G4OpenGLStoredViewer.cc:
     33  o Added default colour and default text colour to list of parameters
     34    that trigger a kernel visit.
     35
     365th October 2010  John Allison
     37- G4OpenGLStoredViewer.cc: Time-slices fade to background colour.
     38
     395th October 2010  Laurent Garnier
     40- Change lots of shortcuts in Qt
     41- Add 'google earth like' rotation
    1942
    204323th June 2010  Laurent Garnier
  • trunk/source/visualization/OpenGL/include/CVS/Entries

    r1337 r1340  
    1414/G4OpenGLQtExportDialog.hh/1.7/Thu Sep 30 06:16:49 2010//
    1515/G4OpenGLQtMovieDialog.hh/1.4/Thu Sep 30 06:16:49 2010//
    16 /G4OpenGLQtViewer.hh/1.23/Thu Sep 30 06:16:49 2010//
    1716/G4OpenGLSceneHandler.hh/1.30/Thu Sep 30 06:16:49 2010//
    1817/G4OpenGLSceneHandler.icc/1.9/Thu Sep 30 06:16:49 2010//
    1918/G4OpenGLStoredQt.hh/1.2/Thu Sep 30 06:16:49 2010//
    2019/G4OpenGLStoredQtViewer.hh/1.10/Thu Sep 30 06:16:49 2010//
    21 /G4OpenGLStoredSceneHandler.hh/1.28/Thu Sep 30 06:16:49 2010//
    2220/G4OpenGLStoredViewer.hh/1.10/Thu Sep 30 06:16:49 2010//
    2321/G4OpenGLStoredWin32.hh/1.8/Thu Sep 30 06:16:49 2010//
     
    2826/G4OpenGLStoredXmViewer.hh/1.8/Thu Sep 30 06:16:50 2010//
    2927/G4OpenGLTransform3D.hh/1.8/Thu Sep 30 06:16:50 2010//
    30 /G4OpenGLViewer.hh/1.32/Thu Sep 30 06:16:50 2010//
    31 /G4OpenGLViewerMessenger.hh/1.7/Thu Sep 30 06:16:50 2010//
    3228/G4OpenGLWin32Viewer.hh/1.15/Thu Sep 30 06:16:50 2010//
    3329/G4OpenGLXViewer.hh/1.32/Thu Sep 30 06:16:50 2010//
     
    4844/G4OpenGLXmViewer.hh/1.11/Thu Sep 30 06:16:50 2010//
    4945/G4OpenGLXmViewerMessenger.hh/1.5/Thu Sep 30 06:16:50 2010//
     46/G4OpenGLViewer.hh/1.33/Tue Oct  5 15:45:19 2010//
     47/G4OpenGLQtViewer.hh/1.25/Fri Oct  8 10:07:31 2010//
     48/G4OpenGLStoredSceneHandler.hh/1.29/Fri Nov  5 10:16:52 2010//
     49/G4OpenGLViewerMessenger.hh/1.8/Fri Nov  5 10:16:52 2010//
    5050D
  • trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r1333 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.hh,v 1.23 2010/06/04 15:27:47 lgarnier Exp $
     27// $Id: G4OpenGLQtViewer.hh,v 1.25 2010/10/08 10:07:31 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    231231  void actionDrawingLineSurfaceRemoval();
    232232  void actionSaveImage();
     233  void actionChangeBackgroundColor();
     234  void actionChangeTextColor();
     235  void actionChangeDefaultColor();
    233236  void actionMovieParameters();
    234237
     
    238241  void toggleRepresentation(bool);
    239242  void toggleProjection(bool);
    240   void toggleBackground(bool);
    241243  void toggleTransparency(bool);
    242244  void toggleAntialiasing(bool);
  • trunk/source/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.28 2009/02/04 16:48:40 lgarnier Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4OpenGLStoredSceneHandler.hh,v 1.29 2010/11/05 06:25:23 allison Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    6969  void ClearTransientStore ();
    7070
     71  static G4int GetDisplayListLimit() {return fDisplayListLimit;}
     72  static void SetDisplayListLimit(G4int lim) {fDisplayListLimit = lim;}
     73
    7174protected:
    7275
     
    7780  static G4int     fSceneIdCount;   // static counter for OpenGLStored scenes.
    7881  G4int            fDisplayListId;  // Workspace.
    79   G4bool  fMemoryForDisplayLists;   // avoid memory overflow
     82  G4bool fMemoryForDisplayLists;    // avoid memory overflow
     83  static G4int fDisplayListLimit;   // avoid memory overflow
     84  static G4int fDisplayListBase;    // avoid memory overflow
    8085  G4int fAddPrimitivePreambleNestingDepth;
    8186 
  • trunk/source/visualization/OpenGL/include/G4OpenGLViewer.hh

    r1332 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.hh,v 1.32 2009/05/14 16:38:23 lgarnier Exp $
     27// $Id: G4OpenGLViewer.hh,v 1.33 2010/10/05 15:45:19 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
  • trunk/source/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.hh,v 1.7 2009/05/18 09:07:12 lgarnier Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4OpenGLViewerMessenger.hh,v 1.8 2010/11/05 06:25:23 allison Exp $
     28// GEANT4 tag $Name: $
    2929
    3030#ifndef G4OPENGLVIEWERMESSENGER_HH
     
    4141class G4UIcmdWithABool;
    4242class G4UIcmdWithAString;
     43class G4UIcmdWithAnInteger;
    4344
    4445class G4OpenGLViewerMessenger: public G4UImessenger {
     
    5758  G4UIdirectory* fpDirectorySet;
    5859  G4UIcommand* fpCommandDisplayHeadTime;
     60  G4UIcmdWithAnInteger* fpCommandDisplayListLimit;
    5961  G4UIcommand* fpCommandDisplayLightFront;
    6062  G4UIcommand* fpCommandEndTime;
  • trunk/source/visualization/OpenGL/src/CVS/Entries

    r1337 r1340  
    1414/G4OpenGLSceneHandler.cc/1.59/Thu Sep 30 06:16:59 2010//
    1515/G4OpenGLStoredQt.cc/1.10/Thu Sep 30 06:16:59 2010//
    16 /G4OpenGLStoredSceneHandler.cc/1.42/Thu Sep 30 06:16:59 2010//
    17 /G4OpenGLStoredViewer.cc/1.26/Thu Sep 30 06:16:59 2010//
    1816/G4OpenGLStoredWin32.cc/1.15/Thu Sep 30 06:17:00 2010//
    1917/G4OpenGLStoredWin32Viewer.cc/1.22/Thu Sep 30 06:17:00 2010//
     
    2321/G4OpenGLStoredXmViewer.cc/1.26/Thu Sep 30 06:17:00 2010//
    2422/G4OpenGLTransform3D.cc/1.9/Thu Sep 30 06:17:00 2010//
    25 /G4OpenGLViewer.cc/1.62/Thu Sep 30 06:17:00 2010//
    26 /G4OpenGLViewerMessenger.cc/1.18/Thu Sep 30 06:17:00 2010//
    2723/G4OpenGLWin32Viewer.cc/1.20/Thu Sep 30 06:17:00 2010//
    2824/G4OpenGLXViewer.cc/1.55/Thu Sep 30 06:17:00 2010//
     
    4945/G4OpenGLXmWindowHandlingCallbacks.cc/1.11/Thu Sep 30 06:17:09 2010//
    5046/G4OpenGLImmediateQtViewer.cc/1.22/Thu Sep 30 11:54:33 2010//
    51 /G4OpenGLQtViewer.cc/1.52/Thu Sep 30 11:54:33 2010//
    5247/G4OpenGLStoredQtViewer.cc/1.32/Thu Sep 30 11:54:33 2010//
     48/G4OpenGLViewer.cc/1.63/Tue Oct  5 15:45:19 2010//
     49/G4OpenGLStoredViewer.cc/1.29/Wed Oct  6 15:59:03 2010//
     50/G4OpenGLQtViewer.cc/1.55/Fri Oct  8 10:07:31 2010//
     51/G4OpenGLStoredSceneHandler.cc/1.43/Fri Nov  5 10:16:52 2010//
     52/G4OpenGLViewerMessenger.cc/1.19/Fri Nov  5 10:16:52 2010//
    5353D
  • trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r1335 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLQtViewer.cc,v 1.52 2010/06/23 13:29:23 lgarnier Exp $
     27// $Id: G4OpenGLQtViewer.cc,v 1.55 2010/10/08 10:07:31 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    7979#include <qgl.h> // include <qglwidget.h>
    8080#include <qdialog.h>
     81#include <qcolordialog.h>
    8182#include <qevent.h> //include <qcontextmenuevent.h>
    8283
     
    111112  //  fWindow->makeCurrent();
    112113
    113 #ifdef G4DEBUG_VIS_OGL
    114 #if QT_VERSION < 0x040000
    115   printf("G4OpenGLQtViewer::CreateMainWindow :: ++++++++++++++ add new TAB %s  W:%d H:%d SizeHinX:%d SizeHintY:%d\n",name.ascii(),getWinWidth(),getWinHeight(),fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
    116 #else
    117   printf("G4OpenGLQtViewer::CreateMainWindow :: ++++++++++++++ add new TAB %s  W:%d H:%d SizeHinX:%d SizeHintY:%d\n",name.toStdString().c_str(),getWinWidth(),getWinHeight(),fVP.GetWindowSizeHintX(),fVP.GetWindowSizeHintY());
    118 #endif
    119 #endif
    120114  //G4Qt* interactorManager = G4Qt::getInstance ();
    121115
     
    552546#endif
    553547
    554 
    555 
    556 #if QT_VERSION < 0x040000
    557   QPopupMenu *mBackground = new QPopupMenu(mStyle);
    558   mStyle->insertItem("&Background color",mBackground);
     548  // Background Color
     549
     550  QAction *backgroundColorChooser ;
     551#if QT_VERSION < 0x040000
     552  QPopupMenu *mBackgroundColor = new QPopupMenu(mStyle);
     553  mStyle->insertItem("&Background color",mBackgroundColor);
    559554
    560555#if QT_VERSION < 0x030200
    561   QAction *white = new QAction("&White","&White",CTRL+Key_W,mBackground,0,true);
    562   QAction *black =  new QAction("&Black","&Black",CTRL+Key_B,mBackground,0,true);
    563 #else
    564   QAction *white = new QAction("&White",CTRL+Key_W,mBackground);
    565   QAction *black =  new QAction("&Black",CTRL+Key_B,mBackground);
    566   white->setToggleAction(true);
    567   black->setToggleAction(true);
    568 #endif
    569   white->addTo(mBackground);
    570   black->addTo(mBackground);
    571 
    572 #else
    573   QMenu *mBackground = mStyle->addMenu("&Background color");
    574   QAction *white = mBackground->addAction("White");
    575   QAction *black = mBackground->addAction("Black");
    576 
    577 #endif
    578   if (background.GetRed() == 1. &&
    579       background.GetGreen() == 1. &&
    580       background.GetBlue() == 1.) {
    581     createRadioAction(white,black,SLOT(toggleBackground(bool)),1);
    582   } else {
    583     createRadioAction(white,black,SLOT(toggleBackground(bool)),2);
    584   }
     556  backgroundColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mBackgroundColor,0,true);
     557#else
     558  backgroundColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mBackgroundColor);
     559#endif
     560  backgroundColorChooser->addTo(mBackgroundColor);
     561  QObject ::connect(backgroundColorChooser,
     562                    SIGNAL(activated()),
     563                    this,
     564                    SLOT(actionChangeBackgroundColor()));
     565
     566#else
     567  // === Action Menu ===
     568  backgroundColorChooser = mStyle->addAction("Background color");
     569  QObject ::connect(backgroundColorChooser,
     570                    SIGNAL(triggered()),
     571                    this,
     572                    SLOT(actionChangeBackgroundColor()));
     573#endif
     574
     575  // Text Color
     576
     577  QAction *textColorChooser ;
     578#if QT_VERSION < 0x040000
     579  QPopupMenu *mTextColor = new QPopupMenu(mStyle);
     580  mStyle->insertItem("&Text color",mTextColor);
     581
     582#if QT_VERSION < 0x030200
     583  textColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mTextColor,0,true);
     584#else
     585  textColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mTextColor);
     586#endif
     587  textColorChooser->addTo(mTextColor);
     588  QObject ::connect(textColorChooser,
     589                    SIGNAL(activated()),
     590                    this,
     591                    SLOT(actionChangeTextColor()));
     592
     593#else
     594  // === Action Menu ===
     595  textColorChooser = mStyle->addAction("Text color");
     596  QObject ::connect(textColorChooser,
     597                    SIGNAL(triggered()),
     598                    this,
     599                    SLOT(actionChangeTextColor()));
     600#endif
     601
     602  // Default Color
     603
     604  QAction *defaultColorChooser ;
     605#if QT_VERSION < 0x040000
     606  QPopupMenu *mDefaultColor = new QPopupMenu(mStyle);
     607  mStyle->insertItem("&Default color",mDefaultColor);
     608
     609#if QT_VERSION < 0x030200
     610  defaultColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mDefaultColor,0,true);
     611#else
     612  defaultColorChooser =  new QAction("&Choose ...","&Choose ...",CTRL+Key_C,mDefaultColor);
     613#endif
     614  defaultColorChooser->addTo(mDefaultColor);
     615  QObject ::connect(defaultColorChooser,
     616                    SIGNAL(activated()),
     617                    this,
     618                    SLOT(actionChangeDefaultColor()));
     619
     620#else
     621  // === Action Menu ===
     622  defaultColorChooser = mStyle->addAction("Default color");
     623  QObject ::connect(defaultColorChooser,
     624                    SIGNAL(triggered()),
     625                    this,
     626                    SLOT(actionChangeDefaultColor()));
     627#endif
    585628
    586629
     
    11011144
    11021145  if (check == 1) {
    1103     fVP.SetFieldHalfAngle (0);
     1146    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection o");
    11041147  } else {
    1105 
    1106     // look for the default parameter hidden in G4UIcommand parameters
    1107     G4UImanager* UI = G4UImanager::GetUIpointer();
    1108     if(UI==NULL)
    1109       return;
    1110     G4UIcommandTree * treeTop = UI->GetTree();
    1111 
    1112     // find command
    1113     G4UIcommand* command = treeTop->FindPath("/vis/viewer/set/projection");
    1114     if (!command)
    1115       return;
    1116 
    1117     // find param
    1118     G4UIparameter * angleParam = NULL;
    1119     for(G4int i=0;  i<command->GetParameterEntries(); i++)
    1120     {
    1121       if( command->GetParameter(i)->GetParameterName() == "field-half-angle" ) {
    1122         angleParam = command->GetParameter(i);
    1123       }
    1124     }
    1125     if (!angleParam)
    1126       return;
    1127 
    1128     // find unit
    1129     G4UIparameter * unitParam = NULL;
    1130     for(G4int i=0;  i<command->GetParameterEntries(); i++)
    1131     {
    1132       if( command->GetParameter(i)->GetParameterName() == "unit" ) {
    1133         unitParam = command->GetParameter(i);
    1134       }
    1135     }
    1136     if (!unitParam)
    1137       return;
    1138 
    1139     G4double defaultValue = command->ConvertToDouble(angleParam->GetDefaultValue())
    1140                             * G4UnitDefinition::GetValueOf(unitParam->GetDefaultValue());
    1141     if (defaultValue > 89.5 || defaultValue <= 0.0) {
    1142       G4cerr << "Field half angle should be 0 < angle <= 89.5 degrees. Check your default Field half angle parameter";
    1143     } else {
    1144       G4cout << "Perspective view has been set to default value. Field half angle="<<angleParam->GetDefaultValue() <<" " << G4endl;
    1145       fVP.SetFieldHalfAngle (defaultValue);
    1146       SetView ();
    1147     }
     1148    G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection p");
    11481149  } 
    11491150  updateQWidget();
    11501151}
    11511152
    1152 
    1153 /**
    1154    SLOT Activate by a click on the background menu
    1155 @param check : 1 white, 0 black
    1156 */
    1157 void G4OpenGLQtViewer::toggleBackground(bool check) {
    1158 
    1159   //   //I need to revisit the kernel if the background colour changes and
    1160   //   //hidden line removal is enabled, because hlr drawing utilises the
    1161   //   //background colour in its drawing...
    1162   //   // (Note added by JA 13/9/2005) Background now handled in view
    1163   //   // parameters.  A kernel visit is triggered on change of background.
    1164   if (check == 1) {
    1165     ((G4ViewParameters&)this->GetViewParameters()).
    1166       SetBackgroundColour(G4Colour(1.,1.,1.));  // White
    1167   } else {
    1168     ((G4ViewParameters&)this->GetViewParameters()).
    1169       SetBackgroundColour(G4Colour(0.,0.,0.));  // Black
    1170   }
    1171   updateQWidget();
    1172 }
    11731153
    11741154/**
     
    12301210void G4OpenGLQtViewer::toggleAux(bool check) {
    12311211  if (check) {
     1212    fVP.SetAuxEdgeVisible(true);
     1213  } else {
    12321214    fVP.SetAuxEdgeVisible(false);
    1233   } else {
    1234     fVP.SetAuxEdgeVisible(true);
    12351215  }
    12361216  SetNeedKernelVisit (true);
     
    13971377  }
    13981378 
     1379}
     1380
     1381
     1382void G4OpenGLQtViewer::actionChangeBackgroundColor() {
     1383
     1384  //   //I need to revisit the kernel if the background colour changes and
     1385  //   //hidden line removal is enabled, because hlr drawing utilises the
     1386  //   //background colour in its drawing...
     1387  //   // (Note added by JA 13/9/2005) Background now handled in view
     1388  //   // parameters.  A kernel visit is triggered on change of background.
     1389
     1390  QColor color;
     1391  color = QColorDialog::getColor(Qt::black, fGLWindow);
     1392  if (color.isValid()) {
     1393    QString com = "/vis/viewer/set/background ";
     1394    QString num;
     1395    com += num.setNum(((float)color.red())/256)+" ";
     1396    com += num.setNum(((float)color.green())/256)+" ";
     1397    com += num.setNum(((float)color.blue())/256)+" ";
     1398    G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
     1399    updateQWidget();
     1400  }
     1401}
     1402
     1403void G4OpenGLQtViewer::actionChangeTextColor() {
     1404
     1405  QColor color;
     1406  color = QColorDialog::getColor(Qt::yellow, fGLWindow);
     1407  if (color.isValid()) {
     1408    QString com = "/vis/viewer/set/defaultTextColour ";
     1409    QString num;
     1410    com += num.setNum(((float)color.red())/256)+" ";
     1411    com += num.setNum(((float)color.green())/256)+" ";
     1412    com += num.setNum(((float)color.blue())/256)+" ";
     1413    G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
     1414    updateQWidget();
     1415  }
     1416}
     1417
     1418void G4OpenGLQtViewer::actionChangeDefaultColor() {
     1419
     1420  QColor color;
     1421  color = QColorDialog::getColor(Qt::white, fGLWindow);
     1422  printf("actionChangeDefaultColor\n");
     1423  if (color.isValid()) {
     1424    QString com = "/vis/viewer/set/defaultColour ";
     1425    QString num;
     1426    com += num.setNum(((float)color.red())/256)+" ";
     1427    com += num.setNum(((float)color.green())/256)+" ";
     1428    com += num.setNum(((float)color.blue())/256)+" ";
     1429    G4UImanager::GetUIpointer()->ApplyCommand(com.toStdString().c_str());
     1430    updateQWidget();
     1431  }
    13991432}
    14001433
     
    15101543
    15111544        if (fMouseAction == STYLE1) {  // rotate
    1512 #ifdef G4DEBUG_VIS_OGL
    1513           printf("G4OpenGLQtViewer:: ___________________________________\n");
    1514           printf("G4OpenGLQtViewer:: mouse move\n");
    1515 #endif
    15161545          if (fNoKeyPress) {
    1517 #ifdef G4DEBUG_VIS_OGL
    1518             printf("G4OpenGLQtViewer:: rotate normal\n");
    1519 #endif
    15201546            rotateQtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
    15211547          } else if (fAltKeyPress) {
    1522 #ifdef G4DEBUG_VIS_OGL
    1523             printf("G4OpenGLQtViewer:: rotate view\n");
    1524 #endif
    15251548            rotateQtSceneInViewDirection(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor);
    15261549          }
     
    15291552          moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true);
    15301553        }
    1531 #ifdef G4DEBUG_VIS_OGL
    1532         printf("G4OpenGLQtViewer::G4MouseReleaseEvent Fps:%f x:%d y:%d cycle:%f\n",(float)1000/lastMoveTime.elapsed(),delta.x(),delta.y(),correctionFactor);
    1533 #endif
    15341554        lastMoveTime.start();
    15351555      }
     
    15831603  if (fMouseAction == STYLE1) {  // rotate
    15841604    if (mButtons & Qt::LeftButton) {
    1585 #ifdef G4DEBUG_VIS_OGL
    1586       printf("G4OpenGLQtViewer:: ___________________________________\n");
    1587       printf("G4OpenGLQtViewer:: mouse move %f %f\n",((float)deltaX),((float)deltaY));
    1588 #endif
    15891605      if (fNoKeyPress) {
    1590 #ifdef G4DEBUG_VIS_OGL
    1591         printf("G4OpenGLQtViewer:: rotate normal\n");
    1592 #endif
    15931606        rotateQtScene(((float)deltaX),((float)deltaY));
    15941607      } else if (fAltKeyPress) {
    1595 #ifdef G4DEBUG_VIS_OGL
    1596         printf("G4OpenGLQtViewer:: rotate view\n");
    1597 #endif
    15981608        rotateQtSceneInViewDirection(((float)deltaX),((float)deltaY));
    15991609      } else if (fShiftKeyPress) {
     
    16081618        moveScene(-(float)deltaX*factor,-(float)deltaY*factor,0,false);
    16091619      } else if (fControlKeyPress) {
    1610 #ifdef G4DEBUG_VIS_OGL
    1611         printf("G4OpenGLQtViewer:: zoom\n");
    1612 #endif
    16131620        fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+((float)deltaY)));
    16141621      }
     
    20242031  }
    20252032#else
    2026 #ifdef G4DEBUG_VIS_OGL
    2027   printf("G4OpenGLQtViewer:: ________________Key Press\n");
    2028 #endif
    20292033  if (modifier & Qt::AltModifier ) {
    20302034    fAltKeyPress = true;
    20312035    fNoKeyPress = false;
    2032 #ifdef G4DEBUG_VIS_OGL
    2033     printf("G4OpenGLQtViewer:: ________________ALT\n");
    2034 #endif
    20352036  }
    20362037  if (modifier & Qt::ShiftModifier ) {
    20372038    fShiftKeyPress = true;
    20382039    fNoKeyPress = false;
    2039 #ifdef G4DEBUG_VIS_OGL
    2040     printf("G4OpenGLQtViewer:: ________________Shift\n");
    2041 #endif
    20422040  }
    20432041  if (modifier & Qt::ControlModifier ) {
    20442042    fControlKeyPress = true;
    20452043    fNoKeyPress = false;
    2046 #ifdef G4DEBUG_VIS_OGL
    2047     printf("G4OpenGLQtViewer:: ________________Control\n");
    2048 #endif
    20492044  }
    20502045#endif
     
    28482843  // G4UImanager* UI =
    28492844  G4UImanager::GetUIpointer();
    2850 #ifdef G4DEBUG_VIS_OGL
    2851   //  printf("G4OpenGLQtViewer::getParentWidget :: UImanager %d  G4Qt:%d et via GetUIQt:%d---------------------\n",UI,UI->GetSession(),interactorManager,interactorManager->GetUIVisWidget());
    2852 #endif
    28532845 
    28542846  bool found = false;
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r1332 r1340  
    4848{
    4949
    50 #ifdef G4DEBUG_VIS_OGL
    51   printf("G4OpenGLStoredQtViewer::constructor VVVVVVVVVVVV\n");
    52 #endif
    5350#if QT_VERSION < 0x040000
    5451  setFocusPolicy(QWidget::StrongFocus); // enable keybord events
     
    5956  fIsRepainting = false;
    6057
    61 #ifdef G4DEBUG_VIS_OGL
    62   printf("G4OpenGLStoredQtViewer::constructor ^^^^^^^^^^^^\n");
    63 #endif
    6458  if (fViewId < 0) return;  // In case error in base class instantiation.
    6559}
     
    7367
    7468void G4OpenGLStoredQtViewer::Initialise() {
    75 #ifdef G4DEBUG_VIS_OGL
    76   printf("G4OpenGLStoredQtViewer::Initialise VVVVVVVVVVVV\n");
    77 #endif
    7869  fReadyToPaint = false;
    7970  CreateMainWindow (this,QString(GetName()));
     
    8172 
    8273  fReadyToPaint = true;
    83 #ifdef G4DEBUG_VIS_OGL
    84   printf("G4OpenGLStoredQtViewer::Initialise ^^^^^^^^^^^^\n");
    85 #endif
    8674}
    8775
    8876void G4OpenGLStoredQtViewer::initializeGL () {
    8977
    90 #ifdef G4DEBUG_VIS_OGL
    91   printf("G4OpenGLStoredQtViewer::InitialiseGL () 0\n");
    92 #endif
    9378  //  return;
    9479  InitializeGLView ();
    9580
    96 #ifdef G4DEBUG_VIS_OGL
    97   printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");
    98 #endif
    9981
    10082  // clear the buffers and window.
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.42 2010/06/03 08:23:02 allison Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4OpenGLStoredSceneHandler.cc,v 1.43 2010/11/05 06:25:23 allison Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    106106  if (fMemoryForDisplayLists) {
    107107    fDisplayListId = glGenLists (1);
    108     if (glGetError() == GL_OUT_OF_MEMORY) {  // Could pre-allocate?
     108    if (glGetError() == GL_OUT_OF_MEMORY ||
     109        fDisplayListId > fDisplayListLimit + fDisplayListBase) {
    109110      G4cout <<
    110111        "********************* WARNING! ********************"
    111         "\nUnable to allocate any more display lists in OpenGL."
    112         "\n     Continuing drawing in IMMEDIATE MODE."
     112        "\n  Display list limit reached in OpenGL."
     113        "\n  Continuing drawing in IMMEDIATE MODE."
     114        "\n  Current limit: "
     115             << fDisplayListLimit <<
     116        ".  Change with \"/vis/ogl/set/displayListLimit\"."
    113117        "\n***************************************************"
    114118             << G4endl;
     
    351355    glDeleteLists(fTOList[i].fDisplayListId, 1);
    352356  fTOList.clear ();
     357
     358  fDisplayListBase = fDisplayListId;
    353359}
    354360
     
    361367    glDeleteLists(fTOList[i].fDisplayListId, 1);
    362368  fTOList.clear ();
     369
     370  fDisplayListBase = fDisplayListId;
    363371
    364372  // Make sure screen corresponds to graphical database...
     
    463471G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0;
    464472
     473G4int G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000;
     474
     475G4int G4OpenGLStoredSceneHandler::fDisplayListBase = 0;
     476
    465477#endif
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredViewer.cc

    r1314 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredViewer.cc,v 1.26 2009/04/08 16:55:44 lgarnier Exp $
    28 // GEANT4 tag $Name: vis-V09-03-06 $
     27// $Id: G4OpenGLStoredViewer.cc,v 1.29 2010/10/06 10:05:52 allison Exp $
     28// GEANT4 tag $Name: $
    2929//
    3030//
     
    8888      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
    8989      (lastVP.IsMarkerNotHidden ()  != fVP.IsMarkerNotHidden ())  ||
     90      (lastVP.GetDefaultVisAttributes()->GetColour() !=
     91       fVP.GetDefaultVisAttributes()->GetColour())                ||
     92      (lastVP.GetDefaultTextVisAttributes()->GetColour() !=
     93       fVP.GetDefaultTextVisAttributes()->GetColour())            ||
    9094      (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
    9195      (lastVP.IsPicking ()          != fVP.IsPicking ())
     
    165169        glMultMatrixd (oglt.GetGLMatrix ());
    166170        if (fVP.IsPicking()) glLoadName(to.fPickName);
    167         G4Colour& c = to.fColour;
     171        const G4Colour& c = to.fColour;
     172        const G4Colour& bg = fVP.GetBackgroundColour();
    168173        G4double bsf = 1.;  // Brightness scaling factor.
    169174        if (fFadeFactor > 0. && to.fEndTime < fEndTime)
    170175          bsf = 1. - fFadeFactor *
    171176            ((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
    172         glColor3d(bsf * c.GetRed (), bsf * c.GetGreen (), bsf * c.GetBlue ());
     177        glColor3d
     178          (bsf * c.GetRed() + (1. - bsf) * bg.GetRed(),
     179           bsf * c.GetGreen() + (1. - bsf) * bg.GetGreen(),
     180           bsf * c.GetBlue() + (1. - bsf) * bg.GetBlue());
    173181        glCallList (to.fDisplayListId);
    174182        glPopMatrix();
  • trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc

    r1335 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.cc,v 1.62 2010/05/11 10:22:37 allison Exp $
     27// $Id: G4OpenGLViewer.cc,v 1.63 2010/10/05 15:45:19 lgarnier Exp $
    2828// GEANT4 tag $Name:  $
    2929//
     
    113113  glDisable (GL_POLYGON_SMOOTH);
    114114
    115   //  if (fVP != NULL) {
    116     fWinSize_x = fVP.GetWindowSizeHintX();
    117     fWinSize_y = fVP.GetWindowSizeHintY();
    118     //  }
     115  fWinSize_x = fVP.GetWindowSizeHintX();
     116  fWinSize_y = fVP.GetWindowSizeHintY();
    119117
    120118
     
    177175  }
    178176   
    179   glViewport(0, 0, fWinSize_x,fWinSize_y);
    180 
    181 #ifdef G4DEBUG_VIS_OGL
    182   printf("G4OpenGLViewer::ResizeGLView END %d %d &:%d\n",fWinSize_x,fWinSize_y,this);
    183 #endif
    184  
     177#ifdef G4DEBUG_VIS_OGL
     178  printf("G4OpenGLViewer::ResizeGLView viewport X:%d Y:%d\n",fWinSize_x,fWinSize_y);
     179#endif
     180  glViewport(0, 0, fWinSize_x,fWinSize_y);   
     181
     182
    185183}
    186184
     
    191189    return;
    192190  }
    193 #ifdef G4DEBUG_VIS_OGL
    194   printf("G4OpenGLViewer::SetView\n");
    195 #endif
    196191  // Calculates view representation based on extent of object being
    197192  // viewed and (initial) viewpoint.  (Note: it can change later due
     
    338333  background = fVP.GetBackgroundColour ();
    339334
    340 #ifdef G4DEBUG_VIS_OGL
    341   printf("G4OpenGLViewer::SetView END\n");
    342 #endif
    343335}
    344336
     
    461453  glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
    462454
     455#ifdef G4DEBUG_VIS_OGL
     456  printf("G4OpenGLViewer::grabPixels colors:%d swap:%d lsb:%d rowlenght:%d sr:%d sp:%d align:%d\n",inColor,swapbytes, lsbfirst, rowlength,skiprows, skippixels, alignment);
     457#endif
     458
     459
    463460  glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
    464461  glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
     
    469466  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
    470467
     468  glFlush();
    471469  glReadBuffer(GL_FRONT);
    472470  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
    473 
     471  //  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, GL_RGB, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
    474472  glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
    475473  glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
     
    529527bool G4OpenGLViewer::printNonVectoredEPS () {
    530528
    531   int width = getRealPrintSizeX();
    532   int height = getRealPrintSizeY();
    533 
    534 #ifdef G4DEBUG_VIS_OGL
    535   printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d col:%d fWinX:%d fWinY:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour,fWinSize_x,fWinSize_y);
     529  GLint viewport[4];
     530  glGetIntegerv(GL_VIEWPORT, viewport);
     531
     532  int width2 = getRealPrintSizeX();
     533  int height2 = getRealPrintSizeY();
     534  int width = viewport[2]; // FIXME : Why -1 ????
     535  int height = viewport[3];
     536
     537#ifdef G4DEBUG_VIS_OGL
     538  printf("G4OpenGLViewer::printNonVectoredEPS file:%s Vec:%d X:%d Y:%d X2:%d Y2:%d col:%d fWinX:%d fWinY:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,width2,height2,fPrintColour,fWinSize_x,fWinSize_y);
    536539#endif
    537540  FILE* fp;
     
    621624  int height = getRealPrintSizeY();
    622625
     626#ifdef G4DEBUG_VIS_OGL
     627  printf("G4OpenGLViewer::printGl2PS file:%s Vec:%d X:%d Y:%d col:%d fWinX:%d fWinY:%d\n",getRealPrintFilename().c_str(),fVectoredPs,width,height,fPrintColour,fWinSize_x,fWinSize_y);
     628#endif
     629
    623630  if (!fGL2PSAction) return false;
    624631
     
    643650
    644651    // Set the viewport
    645     //    fGL2PSAction->setViewport(0, 0, getRealPrintSizeX(),getRealPrintSizeY()); 
     652    //    fGL2PSAction->setViewport(0, 0, width, height); 
    646653    // By default, we choose the line width (trajectories...)
    647654    fGL2PSAction->setLineWidth(1);
     
    693700    return 0;
    694701  }
     702#ifdef G4DEBUG_VIS_OGL
     703  printf("G4OpenGLViewer::getRealPrintSizeX %d\n",fPrintSizeX);
     704#endif
    695705  return fPrintSizeX;
    696706}
     
    712722    return 0;
    713723  }
     724#ifdef G4DEBUG_VIS_OGL
     725  printf("G4OpenGLViewer::getRealPrintSizeY %d\n",fPrintSizeY);
     726#endif
    714727  return fPrintSizeY;
    715728}
     
    825838  //phi spin stuff here
    826839 
    827 
    828 #ifdef G4DEBUG_VIS_OGL
    829   printf("G4OpenGLViewer::rotateScene dx:%f dy:%f delta:%f\n",dx,dy, deltaRotation);
    830 #endif
    831 
    832840  vp = fVP.GetViewpointDirection ().unit ();
    833841  up = fVP.GetUpVector ().unit ();
    834842 
    835 #ifdef G4DEBUG_VIS_OGL
    836   printf("G4OpenGLViewer::rotateScene     vp: %f %f %f\n",vp.x(),vp.y(),vp.z());
    837 #endif
    838843  yprime = (up.cross(vp)).unit();
    839844  zprime = (vp.cross(yprime)).unit();
     
    855860  // to allow more than 360° rotation
    856861
    857   //   const G4Point3D targetPoint
    858   //     = fSceneHandler.GetScene()->GetStandardTargetPoint()
    859   //     + fVP.GetCurrentTargetPoint ();
    860   //   G4double radius = fSceneHandler.GetScene()->GetExtent().GetExtentRadius();
    861   //   if(radius<=0.) radius = 1.;
    862   //  const G4double cameraDistance = fVP.GetCameraDistance (radius);
    863   //  const G4Point3D cameraPosition =
    864   //    targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
    865 
    866862  if (fVP.GetLightsMoveWithCamera()) {
    867 #ifdef G4DEBUG_VIS_OGL
    868   printf("G4OpenGLViewer::rotateScene GetLightsMoveWithCamera: %f \n",new_vp.z()*vp.z());
    869 #endif
    870863    new_up = (new_vp.cross(yprime)).unit();
    871864    if (new_vp.z()*vp.z() <0) {
    872 #ifdef G4DEBUG_VIS_OGL
    873       printf("G4OpenGLViewer::rotateScene  R_____________________________________________\n");
    874 #endif
    875865      new_up.set(new_up.x(),-new_up.y(),new_up.z());
    876866    }
    877867  } else {
    878 #ifdef G4DEBUG_VIS_OGL
    879     printf("G4OpenGLViewer::rotateScene : %f \n",new_vp.z()*vp.z());
    880 #endif
    881868    new_up = up;
    882869    if (new_vp.z()*vp.z() <0) {
    883 #ifdef G4DEBUG_VIS_OGL
    884       printf("G4OpenGLViewer::rotateScene  X_____________________________________________\n");
    885 #endif
    886870      new_up.set(new_up.x(),-new_up.y(),new_up.z());
    887871    }
     
    902886  delta = a2 - a1;
    903887  // So new viewpoint is...
    904 
    905888  viewPoint = new_vp.unit() + delta;
    906 
    907 #ifdef G4DEBUG_VIS_OGL
    908   printf("G4OpenGLViewer::rotateScene     up: %f %f %f\n",up.x(),up.y(),up.z());
    909   printf("G4OpenGLViewer::rotateScene new up: %f %f %f\n",new_up.x(),new_up.y(),new_up.z());
    910   printf("G4OpenGLViewer::rotateScene new vp: %f %f %f delta:%f %f %f\n",new_vp.x(),new_vp.y(),new_vp.z(),delta.x(),delta.y(),delta.z());
    911 #endif
    912  
    913 
     889 
    914890  fVP.SetViewAndLights (viewPoint);
    915 
    916 
    917891}
    918892
  • trunk/source/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc

    r1337 r1340  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.cc,v 1.18 2009/05/14 16:38:23 lgarnier Exp $
    28 // GEANT4 tag $Name: geant4-09-04-beta-01 $
     27// $Id: G4OpenGLViewerMessenger.cc,v 1.19 2010/11/05 06:25:23 allison Exp $
     28// GEANT4 tag $Name: $
    2929
    3030#ifdef G4VIS_BUILD_OPENGL_DRIVER
     
    4141#include "G4UIcmdWithABool.hh"
    4242#include "G4UIcmdWithAString.hh"
     43#include "G4UIcmdWithAnInteger.hh"
    4344#include "G4VisManager.hh"
    4445#include <sstream>
     
    179180  fpCommandDisplayLightFront->SetParameter(parameter);
    180181
     182  fpCommandDisplayListLimit =
     183    new G4UIcmdWithAnInteger("/vis/ogl/set/displayListLimit", this);
     184  fpCommandDisplayListLimit->SetGuidance
     185    ("Set/reset display list limit (to avoid memory exhaustion).");
     186  fpCommandDisplayListLimit->SetParameterName
     187    ("displayListLimit", omitable = true);
     188  fpCommandDisplayListLimit->SetDefaultValue(50000);
     189
    181190  fpCommandEndTime =
    182191    new G4UIcommand("/vis/ogl/set/endTime", this);
     
    241250  delete fpCommandFade;
    242251  delete fpCommandEndTime;
     252  delete fpCommandDisplayListLimit;
    243253  delete fpCommandDisplayLightFront;
    244254  delete fpCommandDisplayHeadTime;
     
    322332      G4cout <<
    323333  "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS."
    324   "\n  The time slice viewing feature is only implemented for OGL Stored"
    325   "\n  viewers at present.  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
     334  "\n  This feature is only implemented for OGL Stored viewers."
     335  "\n  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
    326336             << G4endl;
    327337      return;
     
    414424    }
    415425
     426  G4OpenGLSceneHandler* pOGLSceneHandler =
     427    dynamic_cast<G4OpenGLSceneHandler*>(pViewer->GetSceneHandler());
     428
     429  if (!pOGLSceneHandler) {
     430    G4cout <<
     431  "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
     432  "\n  OGL.  Use \"/vis/sceneHandler/select\" or \"/vis/open\"."
     433           << G4endl;
     434    return;
     435  }
     436
     437  G4OpenGLStoredSceneHandler* pOGLSSceneHandler =
     438    dynamic_cast<G4OpenGLStoredSceneHandler*>(pViewer->GetSceneHandler());
     439
     440  if (!pOGLSSceneHandler) {
     441    G4cout <<
     442  "G4OpenGLViewerMessenger::SetNewValue: Current scene handler is not of type"
     443  "\n  OGLS (Stored).  This feature is only implemented for OGL Stored"
     444  "\n  scene handlers.  Use \"/vis/viewer/select\" or \"/vis/open OGLS...\"."
     445           << G4endl;
     446    return;
     447  }
     448
     449  if (command == fpCommandDisplayListLimit)
     450    {
     451      G4int displayListLimit =
     452        fpCommandDisplayListLimit->GetNewIntValue(newValue);
     453      pOGLSSceneHandler->SetDisplayListLimit(displayListLimit);
     454    }
    416455}
    417456
Note: See TracChangeset for help on using the changeset viewer.