Changeset 1340 for trunk/source/visualization/OpenGL
- Timestamp:
- Nov 5, 2010, 3:45:55 PM (14 years ago)
- Location:
- trunk/source/visualization/OpenGL
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/CVS/Entries
r1337 r1340 4 4 /Doxyfile/1.4/Mon Jul 12 14:53:12 2010// 5 5 /GNUmakefile/1.13/Thu Sep 30 06:16:41 2010// 6 /History/1.180/Thu Sep 30 11:54:25 2010//7 6 /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 11 11 12 12 # For debug mode 13 #CPPFLAGS += -DG4DEBUG_VIS_OGL13 CPPFLAGS += -DG4DEBUG_VIS_OGL 14 14 15 15 GLOBLIBS = libG4vis_management.lib libG4modeling.lib libG4gl2ps.lib -
trunk/source/visualization/OpenGL/History
r1337 r1340 1 $Id: History,v 1.18 0 2010/06/23 13:29:23 lgarnierExp $1 $Id: History,v 1.187 2010/11/05 06:25:23 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 17 17 * Reverse chronological order (last date on top), please * 18 18 ---------------------------------------------------------- 19 20 5th 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 25 8th 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 30 6th 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 36 5th October 2010 John Allison 37 - G4OpenGLStoredViewer.cc: Time-slices fade to background colour. 38 39 5th October 2010 Laurent Garnier 40 - Change lots of shortcuts in Qt 41 - Add 'google earth like' rotation 19 42 20 43 23th June 2010 Laurent Garnier -
trunk/source/visualization/OpenGL/include/CVS/Entries
r1337 r1340 14 14 /G4OpenGLQtExportDialog.hh/1.7/Thu Sep 30 06:16:49 2010// 15 15 /G4OpenGLQtMovieDialog.hh/1.4/Thu Sep 30 06:16:49 2010// 16 /G4OpenGLQtViewer.hh/1.23/Thu Sep 30 06:16:49 2010//17 16 /G4OpenGLSceneHandler.hh/1.30/Thu Sep 30 06:16:49 2010// 18 17 /G4OpenGLSceneHandler.icc/1.9/Thu Sep 30 06:16:49 2010// 19 18 /G4OpenGLStoredQt.hh/1.2/Thu Sep 30 06:16:49 2010// 20 19 /G4OpenGLStoredQtViewer.hh/1.10/Thu Sep 30 06:16:49 2010// 21 /G4OpenGLStoredSceneHandler.hh/1.28/Thu Sep 30 06:16:49 2010//22 20 /G4OpenGLStoredViewer.hh/1.10/Thu Sep 30 06:16:49 2010// 23 21 /G4OpenGLStoredWin32.hh/1.8/Thu Sep 30 06:16:49 2010// … … 28 26 /G4OpenGLStoredXmViewer.hh/1.8/Thu Sep 30 06:16:50 2010// 29 27 /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//32 28 /G4OpenGLWin32Viewer.hh/1.15/Thu Sep 30 06:16:50 2010// 33 29 /G4OpenGLXViewer.hh/1.32/Thu Sep 30 06:16:50 2010// … … 48 44 /G4OpenGLXmViewer.hh/1.11/Thu Sep 30 06:16:50 2010// 49 45 /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// 50 50 D -
trunk/source/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r1333 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.hh,v 1.2 3 2010/06/04 15:27:47lgarnier Exp $27 // $Id: G4OpenGLQtViewer.hh,v 1.25 2010/10/08 10:07:31 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 231 231 void actionDrawingLineSurfaceRemoval(); 232 232 void actionSaveImage(); 233 void actionChangeBackgroundColor(); 234 void actionChangeTextColor(); 235 void actionChangeDefaultColor(); 233 236 void actionMovieParameters(); 234 237 … … 238 241 void toggleRepresentation(bool); 239 242 void toggleProjection(bool); 240 void toggleBackground(bool);241 243 void toggleTransparency(bool); 242 244 void toggleAntialiasing(bool); -
trunk/source/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.2 8 2009/02/04 16:48:40 lgarnierExp $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: $ 29 29 // 30 30 // … … 69 69 void ClearTransientStore (); 70 70 71 static G4int GetDisplayListLimit() {return fDisplayListLimit;} 72 static void SetDisplayListLimit(G4int lim) {fDisplayListLimit = lim;} 73 71 74 protected: 72 75 … … 77 80 static G4int fSceneIdCount; // static counter for OpenGLStored scenes. 78 81 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 80 85 G4int fAddPrimitivePreambleNestingDepth; 81 86 -
trunk/source/visualization/OpenGL/include/G4OpenGLViewer.hh
r1332 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.hh,v 1.3 2 2009/05/14 16:38:23lgarnier Exp $27 // $Id: G4OpenGLViewer.hh,v 1.33 2010/10/05 15:45:19 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // -
trunk/source/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.hh,v 1. 7 2009/05/18 09:07:12 lgarnierExp $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: $ 29 29 30 30 #ifndef G4OPENGLVIEWERMESSENGER_HH … … 41 41 class G4UIcmdWithABool; 42 42 class G4UIcmdWithAString; 43 class G4UIcmdWithAnInteger; 43 44 44 45 class G4OpenGLViewerMessenger: public G4UImessenger { … … 57 58 G4UIdirectory* fpDirectorySet; 58 59 G4UIcommand* fpCommandDisplayHeadTime; 60 G4UIcmdWithAnInteger* fpCommandDisplayListLimit; 59 61 G4UIcommand* fpCommandDisplayLightFront; 60 62 G4UIcommand* fpCommandEndTime; -
trunk/source/visualization/OpenGL/src/CVS/Entries
r1337 r1340 14 14 /G4OpenGLSceneHandler.cc/1.59/Thu Sep 30 06:16:59 2010// 15 15 /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//18 16 /G4OpenGLStoredWin32.cc/1.15/Thu Sep 30 06:17:00 2010// 19 17 /G4OpenGLStoredWin32Viewer.cc/1.22/Thu Sep 30 06:17:00 2010// … … 23 21 /G4OpenGLStoredXmViewer.cc/1.26/Thu Sep 30 06:17:00 2010// 24 22 /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//27 23 /G4OpenGLWin32Viewer.cc/1.20/Thu Sep 30 06:17:00 2010// 28 24 /G4OpenGLXViewer.cc/1.55/Thu Sep 30 06:17:00 2010// … … 49 45 /G4OpenGLXmWindowHandlingCallbacks.cc/1.11/Thu Sep 30 06:17:09 2010// 50 46 /G4OpenGLImmediateQtViewer.cc/1.22/Thu Sep 30 11:54:33 2010// 51 /G4OpenGLQtViewer.cc/1.52/Thu Sep 30 11:54:33 2010//52 47 /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// 53 53 D -
trunk/source/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r1335 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1.5 2 2010/06/23 13:29:23lgarnier Exp $27 // $Id: G4OpenGLQtViewer.cc,v 1.55 2010/10/08 10:07:31 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 79 79 #include <qgl.h> // include <qglwidget.h> 80 80 #include <qdialog.h> 81 #include <qcolordialog.h> 81 82 #include <qevent.h> //include <qcontextmenuevent.h> 82 83 … … 111 112 // fWindow->makeCurrent(); 112 113 113 #ifdef G4DEBUG_VIS_OGL114 #if QT_VERSION < 0x040000115 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 #else117 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 #endif119 #endif120 114 //G4Qt* interactorManager = G4Qt::getInstance (); 121 115 … … 552 546 #endif 553 547 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); 559 554 560 555 #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 585 628 586 629 … … 1101 1144 1102 1145 if (check == 1) { 1103 fVP.SetFieldHalfAngle (0);1146 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/set/projection o"); 1104 1147 } 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"); 1148 1149 } 1149 1150 updateQWidget(); 1150 1151 } 1151 1152 1152 1153 /**1154 SLOT Activate by a click on the background menu1155 @param check : 1 white, 0 black1156 */1157 void G4OpenGLQtViewer::toggleBackground(bool check) {1158 1159 // //I need to revisit the kernel if the background colour changes and1160 // //hidden line removal is enabled, because hlr drawing utilises the1161 // //background colour in its drawing...1162 // // (Note added by JA 13/9/2005) Background now handled in view1163 // // parameters. A kernel visit is triggered on change of background.1164 if (check == 1) {1165 ((G4ViewParameters&)this->GetViewParameters()).1166 SetBackgroundColour(G4Colour(1.,1.,1.)); // White1167 } else {1168 ((G4ViewParameters&)this->GetViewParameters()).1169 SetBackgroundColour(G4Colour(0.,0.,0.)); // Black1170 }1171 updateQWidget();1172 }1173 1153 1174 1154 /** … … 1230 1210 void G4OpenGLQtViewer::toggleAux(bool check) { 1231 1211 if (check) { 1212 fVP.SetAuxEdgeVisible(true); 1213 } else { 1232 1214 fVP.SetAuxEdgeVisible(false); 1233 } else {1234 fVP.SetAuxEdgeVisible(true);1235 1215 } 1236 1216 SetNeedKernelVisit (true); … … 1397 1377 } 1398 1378 1379 } 1380 1381 1382 void 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 1403 void 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 1418 void 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 } 1399 1432 } 1400 1433 … … 1510 1543 1511 1544 if (fMouseAction == STYLE1) { // rotate 1512 #ifdef G4DEBUG_VIS_OGL1513 printf("G4OpenGLQtViewer:: ___________________________________\n");1514 printf("G4OpenGLQtViewer:: mouse move\n");1515 #endif1516 1545 if (fNoKeyPress) { 1517 #ifdef G4DEBUG_VIS_OGL1518 printf("G4OpenGLQtViewer:: rotate normal\n");1519 #endif1520 1546 rotateQtScene(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor); 1521 1547 } else if (fAltKeyPress) { 1522 #ifdef G4DEBUG_VIS_OGL1523 printf("G4OpenGLQtViewer:: rotate view\n");1524 #endif1525 1548 rotateQtSceneInViewDirection(((float)delta.x())/correctionFactor,((float)delta.y())/correctionFactor); 1526 1549 } … … 1529 1552 moveScene(-((float)delta.x())/correctionFactor,-((float)delta.y())/correctionFactor,0,true); 1530 1553 } 1531 #ifdef G4DEBUG_VIS_OGL1532 printf("G4OpenGLQtViewer::G4MouseReleaseEvent Fps:%f x:%d y:%d cycle:%f\n",(float)1000/lastMoveTime.elapsed(),delta.x(),delta.y(),correctionFactor);1533 #endif1534 1554 lastMoveTime.start(); 1535 1555 } … … 1583 1603 if (fMouseAction == STYLE1) { // rotate 1584 1604 if (mButtons & Qt::LeftButton) { 1585 #ifdef G4DEBUG_VIS_OGL1586 printf("G4OpenGLQtViewer:: ___________________________________\n");1587 printf("G4OpenGLQtViewer:: mouse move %f %f\n",((float)deltaX),((float)deltaY));1588 #endif1589 1605 if (fNoKeyPress) { 1590 #ifdef G4DEBUG_VIS_OGL1591 printf("G4OpenGLQtViewer:: rotate normal\n");1592 #endif1593 1606 rotateQtScene(((float)deltaX),((float)deltaY)); 1594 1607 } else if (fAltKeyPress) { 1595 #ifdef G4DEBUG_VIS_OGL1596 printf("G4OpenGLQtViewer:: rotate view\n");1597 #endif1598 1608 rotateQtSceneInViewDirection(((float)deltaX),((float)deltaY)); 1599 1609 } else if (fShiftKeyPress) { … … 1608 1618 moveScene(-(float)deltaX*factor,-(float)deltaY*factor,0,false); 1609 1619 } else if (fControlKeyPress) { 1610 #ifdef G4DEBUG_VIS_OGL1611 printf("G4OpenGLQtViewer:: zoom\n");1612 #endif1613 1620 fVP.SetZoomFactor(fVP.GetZoomFactor()*(1+((float)deltaY))); 1614 1621 } … … 2024 2031 } 2025 2032 #else 2026 #ifdef G4DEBUG_VIS_OGL2027 printf("G4OpenGLQtViewer:: ________________Key Press\n");2028 #endif2029 2033 if (modifier & Qt::AltModifier ) { 2030 2034 fAltKeyPress = true; 2031 2035 fNoKeyPress = false; 2032 #ifdef G4DEBUG_VIS_OGL2033 printf("G4OpenGLQtViewer:: ________________ALT\n");2034 #endif2035 2036 } 2036 2037 if (modifier & Qt::ShiftModifier ) { 2037 2038 fShiftKeyPress = true; 2038 2039 fNoKeyPress = false; 2039 #ifdef G4DEBUG_VIS_OGL2040 printf("G4OpenGLQtViewer:: ________________Shift\n");2041 #endif2042 2040 } 2043 2041 if (modifier & Qt::ControlModifier ) { 2044 2042 fControlKeyPress = true; 2045 2043 fNoKeyPress = false; 2046 #ifdef G4DEBUG_VIS_OGL2047 printf("G4OpenGLQtViewer:: ________________Control\n");2048 #endif2049 2044 } 2050 2045 #endif … … 2848 2843 // G4UImanager* UI = 2849 2844 G4UImanager::GetUIpointer(); 2850 #ifdef G4DEBUG_VIS_OGL2851 // printf("G4OpenGLQtViewer::getParentWidget :: UImanager %d G4Qt:%d et via GetUIQt:%d---------------------\n",UI,UI->GetSession(),interactorManager,interactorManager->GetUIVisWidget());2852 #endif2853 2845 2854 2846 bool found = false; -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r1332 r1340 48 48 { 49 49 50 #ifdef G4DEBUG_VIS_OGL51 printf("G4OpenGLStoredQtViewer::constructor VVVVVVVVVVVV\n");52 #endif53 50 #if QT_VERSION < 0x040000 54 51 setFocusPolicy(QWidget::StrongFocus); // enable keybord events … … 59 56 fIsRepainting = false; 60 57 61 #ifdef G4DEBUG_VIS_OGL62 printf("G4OpenGLStoredQtViewer::constructor ^^^^^^^^^^^^\n");63 #endif64 58 if (fViewId < 0) return; // In case error in base class instantiation. 65 59 } … … 73 67 74 68 void G4OpenGLStoredQtViewer::Initialise() { 75 #ifdef G4DEBUG_VIS_OGL76 printf("G4OpenGLStoredQtViewer::Initialise VVVVVVVVVVVV\n");77 #endif78 69 fReadyToPaint = false; 79 70 CreateMainWindow (this,QString(GetName())); … … 81 72 82 73 fReadyToPaint = true; 83 #ifdef G4DEBUG_VIS_OGL84 printf("G4OpenGLStoredQtViewer::Initialise ^^^^^^^^^^^^\n");85 #endif86 74 } 87 75 88 76 void G4OpenGLStoredQtViewer::initializeGL () { 89 77 90 #ifdef G4DEBUG_VIS_OGL91 printf("G4OpenGLStoredQtViewer::InitialiseGL () 0\n");92 #endif93 78 // return; 94 79 InitializeGLView (); 95 80 96 #ifdef G4DEBUG_VIS_OGL97 printf("G4OpenGLStoredQtViewer::InitialiseGL () 1\n");98 #endif99 81 100 82 // clear the buffers and window. -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.4 2 2010/06/03 08:23:02allison 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: $ 29 29 // 30 30 // … … 106 106 if (fMemoryForDisplayLists) { 107 107 fDisplayListId = glGenLists (1); 108 if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate? 108 if (glGetError() == GL_OUT_OF_MEMORY || 109 fDisplayListId > fDisplayListLimit + fDisplayListBase) { 109 110 G4cout << 110 111 "********************* 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\"." 113 117 "\n***************************************************" 114 118 << G4endl; … … 351 355 glDeleteLists(fTOList[i].fDisplayListId, 1); 352 356 fTOList.clear (); 357 358 fDisplayListBase = fDisplayListId; 353 359 } 354 360 … … 361 367 glDeleteLists(fTOList[i].fDisplayListId, 1); 362 368 fTOList.clear (); 369 370 fDisplayListBase = fDisplayListId; 363 371 364 372 // Make sure screen corresponds to graphical database... … … 463 471 G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0; 464 472 473 G4int G4OpenGLStoredSceneHandler::fDisplayListLimit = 50000; 474 475 G4int G4OpenGLStoredSceneHandler::fDisplayListBase = 0; 476 465 477 #endif -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
r1314 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredViewer.cc,v 1.2 6 2009/04/08 16:55:44 lgarnierExp $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: $ 29 29 // 30 30 // … … 88 88 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) || 89 89 (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) || 90 (lastVP.GetDefaultVisAttributes()->GetColour() != 91 fVP.GetDefaultVisAttributes()->GetColour()) || 92 (lastVP.GetDefaultTextVisAttributes()->GetColour() != 93 fVP.GetDefaultTextVisAttributes()->GetColour()) || 90 94 (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())|| 91 95 (lastVP.IsPicking () != fVP.IsPicking ()) … … 165 169 glMultMatrixd (oglt.GetGLMatrix ()); 166 170 if (fVP.IsPicking()) glLoadName(to.fPickName); 167 G4Colour& c = to.fColour; 171 const G4Colour& c = to.fColour; 172 const G4Colour& bg = fVP.GetBackgroundColour(); 168 173 G4double bsf = 1.; // Brightness scaling factor. 169 174 if (fFadeFactor > 0. && to.fEndTime < fEndTime) 170 175 bsf = 1. - fFadeFactor * 171 176 ((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()); 173 181 glCallList (to.fDisplayListId); 174 182 glPopMatrix(); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r1335 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.cc,v 1.6 2 2010/05/11 10:22:37 allisonExp $27 // $Id: G4OpenGLViewer.cc,v 1.63 2010/10/05 15:45:19 lgarnier Exp $ 28 28 // GEANT4 tag $Name: $ 29 29 // … … 113 113 glDisable (GL_POLYGON_SMOOTH); 114 114 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(); 119 117 } 120 118 … … 177 175 } 178 176 179 glViewport(0, 0, fWinSize_x,fWinSize_y); 180 181 # ifdef G4DEBUG_VIS_OGL182 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 185 183 } 186 184 … … 191 189 return; 192 190 } 193 #ifdef G4DEBUG_VIS_OGL194 printf("G4OpenGLViewer::SetView\n");195 #endif196 191 // Calculates view representation based on extent of object being 197 192 // viewed and (initial) viewpoint. (Note: it can change later due … … 338 333 background = fVP.GetBackgroundColour (); 339 334 340 #ifdef G4DEBUG_VIS_OGL341 printf("G4OpenGLViewer::SetView END\n");342 #endif343 335 } 344 336 … … 461 453 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment); 462 454 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 463 460 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE); 464 461 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE); … … 469 466 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 470 467 468 glFlush(); 471 469 glReadBuffer(GL_FRONT); 472 470 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); 474 472 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes); 475 473 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst); … … 529 527 bool G4OpenGLViewer::printNonVectoredEPS () { 530 528 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); 536 539 #endif 537 540 FILE* fp; … … 621 624 int height = getRealPrintSizeY(); 622 625 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 623 630 if (!fGL2PSAction) return false; 624 631 … … 643 650 644 651 // Set the viewport 645 // fGL2PSAction->setViewport(0, 0, getRealPrintSizeX(),getRealPrintSizeY());652 // fGL2PSAction->setViewport(0, 0, width, height); 646 653 // By default, we choose the line width (trajectories...) 647 654 fGL2PSAction->setLineWidth(1); … … 693 700 return 0; 694 701 } 702 #ifdef G4DEBUG_VIS_OGL 703 printf("G4OpenGLViewer::getRealPrintSizeX %d\n",fPrintSizeX); 704 #endif 695 705 return fPrintSizeX; 696 706 } … … 712 722 return 0; 713 723 } 724 #ifdef G4DEBUG_VIS_OGL 725 printf("G4OpenGLViewer::getRealPrintSizeY %d\n",fPrintSizeY); 726 #endif 714 727 return fPrintSizeY; 715 728 } … … 825 838 //phi spin stuff here 826 839 827 828 #ifdef G4DEBUG_VIS_OGL829 printf("G4OpenGLViewer::rotateScene dx:%f dy:%f delta:%f\n",dx,dy, deltaRotation);830 #endif831 832 840 vp = fVP.GetViewpointDirection ().unit (); 833 841 up = fVP.GetUpVector ().unit (); 834 842 835 #ifdef G4DEBUG_VIS_OGL836 printf("G4OpenGLViewer::rotateScene vp: %f %f %f\n",vp.x(),vp.y(),vp.z());837 #endif838 843 yprime = (up.cross(vp)).unit(); 839 844 zprime = (vp.cross(yprime)).unit(); … … 855 860 // to allow more than 360° rotation 856 861 857 // const G4Point3D targetPoint858 // = 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 866 862 if (fVP.GetLightsMoveWithCamera()) { 867 #ifdef G4DEBUG_VIS_OGL868 printf("G4OpenGLViewer::rotateScene GetLightsMoveWithCamera: %f \n",new_vp.z()*vp.z());869 #endif870 863 new_up = (new_vp.cross(yprime)).unit(); 871 864 if (new_vp.z()*vp.z() <0) { 872 #ifdef G4DEBUG_VIS_OGL873 printf("G4OpenGLViewer::rotateScene R_____________________________________________\n");874 #endif875 865 new_up.set(new_up.x(),-new_up.y(),new_up.z()); 876 866 } 877 867 } else { 878 #ifdef G4DEBUG_VIS_OGL879 printf("G4OpenGLViewer::rotateScene : %f \n",new_vp.z()*vp.z());880 #endif881 868 new_up = up; 882 869 if (new_vp.z()*vp.z() <0) { 883 #ifdef G4DEBUG_VIS_OGL884 printf("G4OpenGLViewer::rotateScene X_____________________________________________\n");885 #endif886 870 new_up.set(new_up.x(),-new_up.y(),new_up.z()); 887 871 } … … 902 886 delta = a2 - a1; 903 887 // So new viewpoint is... 904 905 888 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 914 890 fVP.SetViewAndLights (viewPoint); 915 916 917 891 } 918 892 -
trunk/source/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
r1337 r1340 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.cc,v 1.1 8 2009/05/14 16:38:23 lgarnierExp $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: $ 29 29 30 30 #ifdef G4VIS_BUILD_OPENGL_DRIVER … … 41 41 #include "G4UIcmdWithABool.hh" 42 42 #include "G4UIcmdWithAString.hh" 43 #include "G4UIcmdWithAnInteger.hh" 43 44 #include "G4VisManager.hh" 44 45 #include <sstream> … … 179 180 fpCommandDisplayLightFront->SetParameter(parameter); 180 181 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 181 190 fpCommandEndTime = 182 191 new G4UIcommand("/vis/ogl/set/endTime", this); … … 241 250 delete fpCommandFade; 242 251 delete fpCommandEndTime; 252 delete fpCommandDisplayListLimit; 243 253 delete fpCommandDisplayLightFront; 244 254 delete fpCommandDisplayHeadTime; … … 322 332 G4cout << 323 333 "G4OpenGLViewerMessenger::SetNewValue: Current viewer is not of type OGLS." 324 "\n Th e 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...\"." 326 336 << G4endl; 327 337 return; … … 414 424 } 415 425 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 } 416 455 } 417 456
Note: See TracChangeset
for help on using the changeset viewer.