Changeset 593 for trunk/geant4/visualization/OpenGL
- Timestamp:
- Nov 9, 2007, 3:32:25 PM (18 years ago)
- Location:
- trunk/geant4/visualization/OpenGL
- Files:
-
- 99 edited
-
GNUmakefile (modified) (1 diff)
-
History (modified) (2 diffs)
-
include/G4OpenGL.hh (modified) (2 diffs)
-
include/G4OpenGLFontBaseStore.hh (modified) (1 diff)
-
include/G4OpenGLImmediateQt.hh (modified) (1 diff)
-
include/G4OpenGLImmediateQtViewer.hh (modified) (2 diffs)
-
include/G4OpenGLImmediateSceneHandler.hh (modified) (2 diffs)
-
include/G4OpenGLImmediateViewer.hh (modified) (1 diff)
-
include/G4OpenGLImmediateWin32.hh (modified) (1 diff)
-
include/G4OpenGLImmediateWin32Viewer.hh (modified) (1 diff)
-
include/G4OpenGLImmediateX.hh (modified) (1 diff)
-
include/G4OpenGLImmediateXViewer.hh (modified) (1 diff)
-
include/G4OpenGLImmediateXm.hh (modified) (1 diff)
-
include/G4OpenGLImmediateXmViewer.hh (modified) (1 diff)
-
include/G4OpenGLQtExportDialog.hh (modified) (5 diffs)
-
include/G4OpenGLQtViewer.hh (modified) (2 diffs)
-
include/G4OpenGLSceneHandler.hh (modified) (3 diffs)
-
include/G4OpenGLSceneHandler.icc (modified) (1 diff)
-
include/G4OpenGLStoredQt.hh (modified) (1 diff)
-
include/G4OpenGLStoredQtViewer.hh (modified) (2 diffs)
-
include/G4OpenGLStoredSceneHandler.hh (modified) (5 diffs)
-
include/G4OpenGLStoredViewer.hh (modified) (1 diff)
-
include/G4OpenGLStoredWin32.hh (modified) (1 diff)
-
include/G4OpenGLStoredWin32Viewer.hh (modified) (1 diff)
-
include/G4OpenGLStoredX.hh (modified) (1 diff)
-
include/G4OpenGLStoredXViewer.hh (modified) (1 diff)
-
include/G4OpenGLStoredXm.hh (modified) (1 diff)
-
include/G4OpenGLStoredXmViewer.hh (modified) (1 diff)
-
include/G4OpenGLTransform3D.hh (modified) (1 diff)
-
include/G4OpenGLViewer.hh (modified) (4 diffs)
-
include/G4OpenGLViewerMessenger.hh (modified) (4 diffs)
-
include/G4OpenGLWin32Viewer.hh (modified) (1 diff)
-
include/G4OpenGLXViewer.hh (modified) (5 diffs)
-
include/G4OpenGLXmBox.hh (modified) (1 diff)
-
include/G4OpenGLXmFourArrowButtons.hh (modified) (1 diff)
-
include/G4OpenGLXmFramedBox.hh (modified) (1 diff)
-
include/G4OpenGLXmPushButton.hh (modified) (1 diff)
-
include/G4OpenGLXmRadioButton.hh (modified) (1 diff)
-
include/G4OpenGLXmResources.hh (modified) (1 diff)
-
include/G4OpenGLXmSeparator.hh (modified) (1 diff)
-
include/G4OpenGLXmSliderBar.hh (modified) (1 diff)
-
include/G4OpenGLXmTextField.hh (modified) (1 diff)
-
include/G4OpenGLXmTopLevelShell.hh (modified) (1 diff)
-
include/G4OpenGLXmVWidgetComponent.hh (modified) (1 diff)
-
include/G4OpenGLXmVWidgetContainer.hh (modified) (1 diff)
-
include/G4OpenGLXmVWidgetObject.hh (modified) (1 diff)
-
include/G4OpenGLXmVWidgetShell.hh (modified) (1 diff)
-
include/G4OpenGLXmViewer.hh (modified) (1 diff)
-
include/G4OpenGLXmViewerMessenger.hh (modified) (1 diff)
-
src/G4OpenGLFontBaseStore.cc (modified) (1 diff)
-
src/G4OpenGLImmediateQt.cc (modified) (1 diff)
-
src/G4OpenGLImmediateQtViewer.cc (modified) (1 diff)
-
src/G4OpenGLImmediateSceneHandler.cc (modified) (9 diffs)
-
src/G4OpenGLImmediateViewer.cc (modified) (1 diff)
-
src/G4OpenGLImmediateWin32.cc (modified) (1 diff)
-
src/G4OpenGLImmediateWin32Viewer.cc (modified) (1 diff)
-
src/G4OpenGLImmediateX.cc (modified) (3 diffs)
-
src/G4OpenGLImmediateXViewer.cc (modified) (1 diff)
-
src/G4OpenGLImmediateXm.cc (modified) (1 diff)
-
src/G4OpenGLImmediateXmViewer.cc (modified) (1 diff)
-
src/G4OpenGLQtExportDialog.cc (modified) (8 diffs)
-
src/G4OpenGLQtViewer.cc (modified) (3 diffs)
-
src/G4OpenGLSceneHandler.cc (modified) (16 diffs)
-
src/G4OpenGLStoredQt.cc (modified) (1 diff)
-
src/G4OpenGLStoredQtViewer.cc (modified) (2 diffs)
-
src/G4OpenGLStoredSceneHandler.cc (modified) (10 diffs)
-
src/G4OpenGLStoredViewer.cc (modified) (6 diffs)
-
src/G4OpenGLStoredWin32.cc (modified) (1 diff)
-
src/G4OpenGLStoredWin32Viewer.cc (modified) (2 diffs)
-
src/G4OpenGLStoredX.cc (modified) (3 diffs)
-
src/G4OpenGLStoredXViewer.cc (modified) (2 diffs)
-
src/G4OpenGLStoredXm.cc (modified) (1 diff)
-
src/G4OpenGLStoredXmViewer.cc (modified) (2 diffs)
-
src/G4OpenGLTransform3D.cc (modified) (2 diffs)
-
src/G4OpenGLViewer.cc (modified) (6 diffs)
-
src/G4OpenGLViewerMessenger.cc (modified) (9 diffs)
-
src/G4OpenGLWin32Viewer.cc (modified) (1 diff)
-
src/G4OpenGLXViewer.cc (modified) (14 diffs)
-
src/G4OpenGLXmBox.cc (modified) (1 diff)
-
src/G4OpenGLXmConvenienceRoutines.cc (modified) (1 diff)
-
src/G4OpenGLXmFourArrowButtons.cc (modified) (1 diff)
-
src/G4OpenGLXmFramedBox.cc (modified) (1 diff)
-
src/G4OpenGLXmMainMenubarCallbacks.cc (modified) (1 diff)
-
src/G4OpenGLXmPanningCallbacks.cc (modified) (1 diff)
-
src/G4OpenGLXmPushButton.cc (modified) (1 diff)
-
src/G4OpenGLXmRadioButton.cc (modified) (1 diff)
-
src/G4OpenGLXmRotationCallbacks.cc (modified) (1 diff)
-
src/G4OpenGLXmSeparator.cc (modified) (1 diff)
-
src/G4OpenGLXmSliderBar.cc (modified) (1 diff)
-
src/G4OpenGLXmStyleCallbacks.cc (modified) (1 diff)
-
src/G4OpenGLXmTextField.cc (modified) (1 diff)
-
src/G4OpenGLXmTopLevelShell.cc (modified) (1 diff)
-
src/G4OpenGLXmVWidgetComponent.cc (modified) (1 diff)
-
src/G4OpenGLXmVWidgetContainer.cc (modified) (1 diff)
-
src/G4OpenGLXmVWidgetObject.cc (modified) (1 diff)
-
src/G4OpenGLXmVWidgetShell.cc (modified) (1 diff)
-
src/G4OpenGLXmViewer.cc (modified) (2 diffs)
-
src/G4OpenGLXmViewerMessenger.cc (modified) (1 diff)
-
src/G4OpenGLXmWindowHandlingCallbacks.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/GNUmakefile
r539 r593 28 28 CPPFLAGS += -I$(G4BASE)/intercoms/include 29 29 CPPFLAGS += -I$(G4BASE)/interfaces/common/include 30 CPPFLAGS += -I$(G4BASE)/interfaces/basic/include31 30 CPPFLAGS += -I$(G4BASE)/tracking/include 32 31 CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include -
trunk/geant4/visualization/OpenGL/History
r529 r593 1 $Id: History,v 1. 82 2006/11/21 16:24:58allison Exp $1 $Id: History,v 1.94 2007/08/21 14:05:50 allison Exp $ 2 2 ------------------------------------------------------------------- 3 3 … … 20 20 History file for visualization/OpenGL 21 21 ------------------------------------- 22 23 21st August 2007 John Allison (opengl-V09-00-00) 24 - Removed redundant G4OpenGLXViewerMessenger. 25 26 25th May 2007 John Allison (opengl-V08-03-03) 27 - G4OpenGLSceneHandler and G4OpenGLXViewerMessenger: 28 Fixed gcc-4.1.2 compiler warnings. 29 30 G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function. 31 32 25th May 2007 John Allison (opengl-V08-03-02) 33 - G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function. 34 35 24th May 2007 John Allison (opengl-V08-03-01) 36 - Fixes for SUN. 37 38 16th May 2007 John Allison (opengl-V08-03-00) 39 - Fix compiler warnings on SLC4. 40 - Bug fixes: 41 o Correct path /vis/ogl/set/printMode. 42 o Add SetView to pixmap screen dump ("/vis/ogl/set/printMode pixmap" 43 and "/vis/ogl/printEPS"). 44 45 8th May 2007 John Allison (opengl-V08-02-06) 46 - Moved vectored PostScript printing to G4OpenGLViewer. 47 - /vis/ogl/printEPS should work for all viewers, including Win32. 48 - Introduced /vis/ogl/set/printMode vectored|pixmap, currently only 49 effective on X windows (and still somewhat buggy). 50 51 4th April 2007 John Allison (opengl-V08-02-05 - needs visman-V08-02-04) 52 - Implemented picking for OGLSX ( as well as OGLIX). Hopefully works 53 for OGL*Win32. Still doesn't work for OGL*Xm. 54 55 3rd April 2007 John Allison (opengl-V08-02-04 - needs visman-V08-02-03) 56 - G4OpenGLStoredSceneHandler: 57 o Re-organised display lists on a per-primitive basis, i.e., one 58 display list per primitive. (This is so that, except for text, 59 the colour - or, rather, intensity - can be brought out of the 60 display list into the TOList (Transient Object List) and 61 controlled for the Display-by-Time feature. Previously, if more 62 than one primitive were drawn between BeginPrimitives and 63 EndPrimitives, it would finish up all in one display list, colour 64 commands included. Rationalises and fixes a rare bug in the 65 Display-by-Time feature - see August 2006.) 66 o Added AddPrimitive(const G4Polymarker&) so that it is treated as 67 one primoitive to fit with the above re-organisation. 68 - Implemented picking for OGLIX. 69 70 25th March 2007 John Allison (opengl-V08-02-03) 71 - Fix compiler warnings. 72 73 8th February 2007 John Allison (opengl-V08-02-02) 74 - Fixed Windows problem with DBL_MAX. (Introduced G4OPENGL_DBL_MAX.) 75 - G4OpenGLXViewer.cc: Small bug fix in print(). (Context was switched 76 .but not switched back. Not serious, because context was always set 77 before normal drawing.) 78 79 9th January 2007 John Allison (opengl-V08-02-01) 80 - Implemented bitmap markers for MarkerSizeType == screen. (The old 81 polygon implementation remains for MarkerSizeType == world.) 82 - Added G4OpenGLBitMapStore to assist the above. 83 - G4OpenGLXViewer::CreateGLXContext: 84 o Bug fix: Added missing break in colormap lookup routine. 85 86 5th January 2007 John Allison (opengl-V08-02-00) 87 - G4OpenGLSceneHandler.cc: 88 o Followed change of signature of GetLineWidth in visman-V08-02-00. 89 o Minor efficiency improvements. 22 90 23 91 21st November 2006 John Allison (opengl-V08-01-09) -
trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh
r529 r593 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4OpenGL.hh,v 1. 4 2006/06/29 21:17:36 gunterExp $27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $26 // $Id: G4OpenGL.hh,v 1.5 2007/02/08 14:01:55 allison Exp $ 27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // G.Barrand. … … 39 39 #include <GL/glu.h> 40 40 41 #define G4OPENGL_DBL_MAX 1.e308 42 41 43 #endif -
trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh
r529 r593 25 25 // 26 26 // $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $ 27 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 28 28 // 29 29 // J.Allison Apr 2005. -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh
r533 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQt.hh,v 1. 7 2007/06/25 21:17:44$28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLImmediateQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh
r561 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQtViewer.hh,v 1. 9 2007/06/25 21:17:46$28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLImmediateQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 40 40 #include "G4OpenGLImmediateViewer.hh" 41 41 #include "G4OpenGLQtViewer.hh" 42 #include <QGLWidget> 42 43 #include <QtOpenGL/QGLWidget> 43 44 44 45 #include "globals.hh" -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateSceneHandler.hh,v 1.1 1 2006/08/16 10:34:36 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLImmediateSceneHandler.hh,v 1.13 2007/04/04 16:50:26 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 59 59 void EndModeling (); 60 60 void AddPrimitive (const G4Polyline&); 61 void AddPrimitive (const G4Polymarker&); 62 void AddPrimitive (const G4Text& text); 61 63 void AddPrimitive (const G4Circle&); 62 64 void AddPrimitive (const G4Square&); 63 // Explicitly invoke base class methods to avoid warnings about 64 // hiding of base class methods... 65 void AddPrimitive (const G4Text& text) { 66 G4OpenGLSceneHandler::AddPrimitive (text); 67 } 68 void AddPrimitive (const G4Polyhedron& polyhedron) { 69 G4OpenGLSceneHandler::AddPrimitive (polyhedron); 70 } 71 void AddPrimitive (const G4NURBS& nurbs) { 72 G4OpenGLSceneHandler::AddPrimitive (nurbs); 73 } 74 void AddPrimitive(const G4Polymarker& polymarker) { 75 G4OpenGLSceneHandler::AddPrimitive (polymarker); 76 } 77 void AddPrimitive (const G4Scale& scale) { 78 G4OpenGLSceneHandler::AddPrimitive (scale); 79 } 65 void AddPrimitive (const G4Scale& scale); 66 void AddPrimitive (const G4Polyhedron&); 67 void AddPrimitive (const G4NURBS&); 80 68 void ClearTransientStore (); 81 69 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh
r586 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLQtExportDialog.hh,v 0.1 2007/09/20 15:18:20 garnier$28 // GEANT4 tag $Name: geant4-08-02-patch-01 $27 // $Id: G4OpenGLQtExportDialog.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: 29 29 // 30 30 // … … 35 35 #define G4OPENGLQTEXPORTDIALOG_HH 36 36 37 #include <qvariant.h> 38 #include <qdialog.h> 37 #include <QtGui/QDialog.h> 39 38 40 39 class QButtonGroup; … … 47 46 class QLineEdit; 48 47 48 /** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options 49 for each file format 50 */ 49 51 class G4OpenGLQtExportDialog : public QDialog 50 52 { … … 52 54 53 55 public: 54 G4OpenGLQtExportDialog(QWidget* parent, QString name, int, int); 56 /** Construct a G4OpenGLQtExportDialog 57 @param parent : parent widget 58 @param name : name of the saved file with extention 59 @param height : height of the original file 60 @param width : width of the original file 61 */ 62 G4OpenGLQtExportDialog(QWidget* parent, QString name, int height =0, int width=0); 63 64 /** Destroys G4OpenGLQtExportDialog */ 55 65 ~G4OpenGLQtExportDialog(); 56 66 67 /** @return the value of the slider if format has a slider widget, instead return -1 */ 57 68 int getSliderValue(); 69 70 /** return the new width for file if format has a width widget, instead return -1 */ 58 71 int getWidth(); 72 73 /** return the new height for file if format has a height widget, instead return -1 */ 59 74 int getHeight(); 60 int getTransparency(); 75 76 /** return the value of the transparency if format has a transparency, instead return -1 */ 77 bool getTransparency(); 78 79 /** return the numbers of colors in the picture if format has a BW/Color widget, instead return -1 */ 61 80 int getNbColor(); 62 81 63 82 public slots: 83 84 /** Called by a clic on modify/original size button.This will 85 invert buttons and hide/unhide size 86 */ 64 87 void changeSizeBox(bool); 88 89 /** Called by changing value in height lineEdit. If ratio is keep, will also change the width 90 */ 65 91 void textWidthChanged(const QString &); 92 93 /** Called by changing value in width lineEdit. If ratio is keep, will also change the height 94 */ 66 95 void textHeightChanged(const QString &); 67 68 signals:69 void options(const QString&, const QString&, int, bool);70 void exportAll(const QString&, const QString&, int, bool);71 96 72 97 private: … … 80 105 QSlider * qualitySlider; 81 106 QLabel *formatLabel; 82 QRadioButton* color ,*BW;107 QRadioButton* colorButton,*BWButton; 83 108 QRadioButton* original,* modify; 84 109 QLineEdit* height,*width; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh
r588 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.hh,v 1. 13 2006/06/29 21:18:20 gunter Exp $28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 42 42 #include "G4OpenGLSceneHandler.hh" 43 43 44 #include <QObject> 45 #include <QGLWidget> 46 #include <QDialog> 47 #include <QContextMenuEvent> 48 #include <QMenu> 49 #include <QPoint> 50 #include <QImage> 44 #include <QtCore/QObject> 45 #include <QtCore/QPoint> 46 47 class QGLWidget; 48 class QDialog; 49 class QContextMenuEvent; 50 class QMenu; 51 class QImage; 52 class QAction; 51 53 52 54 class G4OpenGLSceneHandler; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.hh,v 1.2 0 2006/08/30 11:37:34allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLSceneHandler.hh,v 1.23 2007/04/04 16:50:26 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 45 45 #include "G4VSceneHandler.hh" 46 46 #include "G4OpenGLViewer.hh" 47 #include "G4OpenGLBitMapStore.hh" 48 #include <map> 47 49 48 // Base class for various OpenGLScene classes. 50 class G4AttHolder; 51 52 // Base class for various OpenGLSceneHandler classes. 49 53 class G4OpenGLSceneHandler: public G4VSceneHandler { 50 54 55 friend class G4OpenGLViewer; 56 51 57 public: 58 virtual void BeginPrimitives (const G4Transform3D& objectTransformation); 59 virtual void EndPrimitives (); 60 virtual void BeginPrimitives2D (); 61 virtual void EndPrimitives2D (); 52 62 void AddPrimitive (const G4Polyline&); 63 void AddPrimitive (const G4Polymarker&); 53 64 void AddPrimitive (const G4Text&); 54 65 void AddPrimitive (const G4Circle&); 55 66 void AddPrimitive (const G4Square&); 67 void AddPrimitive (const G4Scale&); 56 68 void AddPrimitive (const G4Polyhedron&); 57 69 void AddPrimitive (const G4NURBS&); 58 // Explicitly invoke base class methods to avoid warnings about59 // hiding of base class methods...60 void AddPrimitive(const G4Polymarker& polymarker) {61 G4VSceneHandler::AddPrimitive (polymarker);62 }63 void AddPrimitive (const G4Scale& scale) {64 G4VSceneHandler::AddPrimitive (scale);65 }66 70 71 void PreAddSolid (const G4Transform3D& objectTransformation, 72 const G4VisAttributes&); 67 73 void AddSolid (const G4Box&); 68 74 void AddSolid (const G4Cons&); … … 89 95 const G4Polyhedron* CreateCutawayPolyhedron (); 90 96 97 GLuint fPickName; 98 std::map<GLuint, G4AttHolder*> fPickMap; // For picking. 99 void ClearAndDestroyAtts(); // Destroys att holders and clears pick map. 100 91 101 private: 92 102 93 void AddCircleSquare (const G4VMarker&, G4int nSides); 94 /************************************************** 95 Not needed - but see note on future development in .cc. 96 void DrawScreenPolygon (G4double size, 97 const G4Point3D& centre, 98 G4int nSides); 99 // Draws in screen coordinates. 100 *********************************/ 103 void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape); 101 104 102 void DrawXYPolygon (G4double size, 103 const G4Point3D& centre, 104 G4int nSides); 105 void DrawXYPolygon 106 (G4OpenGLBitMapStore::Shape, 107 G4double size, 108 const G4Point3D& centre, 109 const G4VisAttributes* pApplicableVisAtts); 105 110 // Draws in world coordinates a polygon in the screen plane knowing 106 111 // viewpoint direction and up vector. 107 112 108 113 static const GLubyte fStippleMaskHashed [128]; 114 115 G4bool fProcessingPolymarker; 109 116 }; 110 117 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh
r561 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredQt.hh,v 1. 7 2007/06/25 21:17:44$28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLStoredQt.hh,v 1.1 2007/09/28 14:44:13 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh
r561 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredQtViewer.hh,v 1. 9 2007/06/25 21:17:46$28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLStoredQtViewer.hh,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 40 40 #include "G4OpenGLStoredViewer.hh" 41 41 #include "G4OpenGLQtViewer.hh" 42 #include <QGLWidget> 43 #include <QApplication> 44 #include <QMouseEvent> 45 #include <QContextMenuEvent> 42 43 #include <QtOpenGL/QGLWidget> 44 45 class QMouseEvent; 46 class QContextMenuEvent; 46 47 47 48 class G4OpenGLStoredSceneHandler; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.2 1 2006/08/30 11:43:57allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.24 2007/04/04 16:50:26 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 63 63 void EndModeling (); 64 64 void AddPrimitive (const G4Polyline&); 65 void AddPrimitive (const G4Polymarker&); 65 66 void AddPrimitive (const G4Circle&); 66 67 void AddPrimitive (const G4Square&); 67 void AddPrimitive (const G4Polymarker& polymarker); 68 // Explicitly invoke base class methods to avoid warnings about 69 // hiding of base class methods... 70 void AddPrimitive (const G4Text& text) { 71 G4OpenGLSceneHandler::AddPrimitive (text); 72 } 73 void AddPrimitive (const G4Polyhedron& polyhedron) { 74 G4OpenGLSceneHandler::AddPrimitive (polyhedron); 75 } 76 void AddPrimitive (const G4NURBS& nurbs) { 77 G4OpenGLSceneHandler::AddPrimitive (nurbs); 78 } 79 void AddPrimitive (const G4Scale& scale) { 80 G4OpenGLSceneHandler::AddPrimitive (scale); 81 } 68 void AddPrimitive (const G4Text&); 69 void AddPrimitive (const G4Scale&); 70 void AddPrimitive (const G4Polyhedron&); 71 void AddPrimitive (const G4NURBS&); 82 72 void ClearStore (); 83 73 void ClearTransientStore (); … … 98 88 struct PO { 99 89 PO(G4int id, const G4Transform3D& tr = G4Transform3D()): 100 fDisplayListId(id), fTransform(tr) {}90 fDisplayListId(id), fTransform(tr), fPickName(0) {} 101 91 G4int fDisplayListId; 102 92 G4Transform3D fTransform; 93 GLuint fPickName; 103 94 }; 104 95 std::vector<PO> fPOList; … … 107 98 struct TO { 108 99 TO(G4int id, const G4Transform3D& tr = G4Transform3D()): 109 fDisplayListId(id), fTransform(tr), 110 fStartTime(- DBL_MAX), fEndTime(DBL_MAX) {}100 fDisplayListId(id), fTransform(tr), fPickName(0), 101 fStartTime(-G4OPENGL_DBL_MAX), fEndTime(G4OPENGL_DBL_MAX) {} 111 102 G4int fDisplayListId; 112 103 G4Transform3D fTransform; 104 GLuint fPickName; 113 105 G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps). 114 106 G4Colour fColour; … … 119 111 // A proper implementation would use geometry hierarchy. 120 112 std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap; 113 114 private: 115 G4bool fProcessing2D; 121 116 }; 122 117 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.hh,v 1. 18 2006/09/19 16:13:15allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLViewer.hh,v 1.20 2007/05/08 11:04:11 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 38 38 39 39 #include "G4VViewer.hh" 40 #include "G4OpenGL.hh" 40 41 41 42 class G4OpenGLSceneHandler; … … 62 63 void HLRThirdPass (); 63 64 void InitializeGLView (); 65 void Pick(GLdouble x, GLdouble y); 64 66 virtual void CreateFontLists () {} 67 virtual void print(); 68 //////////////////////////////Vectored PostScript production functions/// 69 void printBuffer(GLint, GLfloat*); 70 GLfloat* spewPrimitiveEPS (FILE*, GLfloat*); 71 void spewSortedFeedback (FILE*, GLint, GLfloat*); 72 void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*); 73 void print3DcolorVertex(GLint, GLint*, GLfloat*); 74 G4float pointSize; 75 char print_string[50]; 76 G4bool print_colour; 77 G4bool vectored_ps; 78 79 G4OpenGLSceneHandler& fOpenGLSceneHandler; 65 80 G4Colour background; //the OpenGL clear colour 66 81 G4bool … … 80 95 }; 81 96 97 typedef struct G4OpenGLViewerFeedback3Dcolor { 98 GLfloat x; 99 GLfloat y; 100 GLfloat z; 101 GLfloat red; 102 GLfloat green; 103 GLfloat blue; 104 GLfloat alpha; 105 } Feedback3Dcolor; 106 82 107 #endif 83 108 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.hh,v 1. 4 2006/09/19 16:14:21 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLViewerMessenger.hh,v 1.5 2007/05/08 11:04:11 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #ifndef G4OPENGLVIEWERMESSENGER_HH … … 37 37 class G4UIdirectory; 38 38 class G4UIcommand; 39 class G4UIcmdWithoutParameter; 39 40 class G4UIcmdWithADouble; 40 41 class G4UIcmdWithABool; 42 class G4UIcmdWithAString; 41 43 42 44 class G4OpenGLViewerMessenger: public G4UImessenger { … … 50 52 static G4OpenGLViewerMessenger* fpInstance; 51 53 G4UIdirectory* fpDirectory; 54 G4UIcmdWithoutParameter* fpCommandPrintEPS; 52 55 G4UIdirectory* fpDirectorySet; 53 56 G4UIcommand* fpCommandDisplayHeadTime; … … 55 58 G4UIcommand* fpCommandEndTime; 56 59 G4UIcmdWithADouble* fpCommandFade; 60 G4UIcmdWithAString* fpCommandPrintMode; 57 61 G4UIcommand* fpCommandStartTime; 58 62 G4UIcmdWithABool* fpCommandTransparency; -
trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.hh,v 1.2 6 2006/11/01 11:22:27allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLXViewer.hh,v 1.27 2007/05/08 11:04:11 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 53 53 54 54 friend class G4OpenGLXViewerMessenger; 55 friend class G4OpenGLXmViewer; 55 56 56 57 public: … … 59 60 void SetView (); 60 61 void ShowView (); 61 void print();62 62 63 63 protected: … … 66 66 virtual void CreateMainWindow (); 67 67 virtual void CreateFontLists (); 68 void print(); 68 69 69 70 static int snglBuf_RGBA[12]; 70 71 static int dblBuf_RGBA[13]; 71 72 72 char print_string[50]; 73 G4bool print_colour, 74 vectored_ps; 75 76 //////////////////////////////Vectored PostScript production functions////////////////////////////// 77 void printBuffer(GLint, GLfloat*); 78 GLfloat* spewPrimitiveEPS (FILE*, GLfloat*); 79 void spewSortedFeedback (FILE*, GLint, GLfloat*); 80 void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*); 81 void print3DcolorVertex(GLint, GLint*, GLfloat*); 82 G4float pointSize; 83 84 85 //////////////////////////////Pixmap (screen dump) production functions////////////////////////////// 73 //////////////////////////////Pixmap (screen dump) production functions///// 86 74 GLubyte* grabPixels (int inColor, 87 75 unsigned int width, … … 129 117 }; 130 118 131 typedef struct G4OpenGLXViewerFeedback3Dcolor {132 GLfloat x;133 GLfloat y;134 GLfloat z;135 GLfloat red;136 GLfloat green;137 GLfloat blue;138 GLfloat alpha;139 } Feedback3Dcolor;140 141 119 #endif 142 120 -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER -
trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc
r550 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQt.cc,v 1.1 1 2007/06/24 12:07:19$28 // GEANT4 tag $Name: geant4-08-02-patch-01$27 // $Id: G4OpenGLImmediateQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateQtViewer.cc,v 1.1 6 2007/06/25 16:38:13$28 // GEANT4 tag $Name: geant4-08-02-patch-01$27 // $Id: G4OpenGLImmediateQtViewer.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc
r554 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateSceneHandler.cc,v 1.2 4 2006/09/04 12:03:25allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLImmediateSceneHandler.cc,v 1.27 2007/04/04 16:50:26 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 47 47 #include "G4OpenGLTransform3D.hh" 48 48 #include "G4Polyline.hh" 49 #include "G4Polymarker.hh" 50 #include "G4Text.hh" 49 51 #include "G4Circle.hh" 50 52 #include "G4Square.hh" 51 52 G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system, 53 const G4String& name): 54 G4OpenGLSceneHandler (system, fSceneIdCount++, name) 53 #include "G4Scale.hh" 54 #include "G4Polyhedron.hh" 55 56 G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler 57 (G4VGraphicsSystem& system,const G4String& name): 58 G4OpenGLSceneHandler (system, fSceneIdCount++, name) 55 59 {} 56 60 … … 62 66 void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible) 63 67 { 68 if (fpViewer->GetViewParameters().IsPicking()) { 69 glLoadName(++fPickName); 70 fPickMap[fPickName] = 0; 71 } 72 64 73 const G4Colour& c = GetColour (visible); 65 74 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); … … 72 81 } 73 82 83 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 84 { 85 AddPrimitivePreamble(polymarker); 86 G4OpenGLSceneHandler::AddPrimitive(polymarker); 87 } 88 89 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Text& text) 90 { 91 // Note: colour is still handled in 92 // G4OpenGLSceneHandler::AddPrimitive(const G4Text&). 93 AddPrimitivePreamble(text); 94 G4OpenGLSceneHandler::AddPrimitive(text); 95 } 96 74 97 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle) 75 98 { … … 84 107 } 85 108 109 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale) 110 { 111 AddPrimitivePreamble(scale); 112 G4OpenGLSceneHandler::AddPrimitive(scale); 113 } 114 115 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) 116 { 117 // Note: colour is still handled in 118 // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&). 119 AddPrimitivePreamble(polyhedron); 120 G4OpenGLSceneHandler::AddPrimitive(polyhedron); 121 } 122 123 void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs) 124 { 125 // Note: colour is still handled in 126 // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&). 127 AddPrimitivePreamble(nurbs); 128 G4OpenGLSceneHandler::AddPrimitive(nurbs); 129 } 130 86 131 void G4OpenGLImmediateSceneHandler::BeginPrimitives 87 132 (const G4Transform3D& objectTransformation) { 88 G4 VSceneHandler::BeginPrimitives (objectTransformation);133 G4OpenGLSceneHandler::BeginPrimitives (objectTransformation); 89 134 glPushMatrix(); 90 135 G4OpenGLTransform3D oglt (objectTransformation); … … 110 155 glFlush (); 111 156 112 G4 VSceneHandler::EndPrimitives ();157 G4OpenGLSceneHandler::EndPrimitives (); 113 158 } 114 159 115 160 void G4OpenGLImmediateSceneHandler::BeginPrimitives2D() 116 161 { 117 G4 VSceneHandler::BeginPrimitives2D();162 G4OpenGLSceneHandler::BeginPrimitives2D(); 118 163 119 164 // Push current 3D world matrices and load identity to define screen … … 122 167 glPushMatrix(); 123 168 glLoadIdentity(); 124 glOrtho (-1., 1., -1., 1., - DBL_MAX,DBL_MAX);169 glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX); 125 170 glMatrixMode (GL_MODELVIEW); 126 171 glPushMatrix(); … … 139 184 glFlush (); 140 185 141 G4 VSceneHandler::EndPrimitives2D ();186 G4OpenGLSceneHandler::EndPrimitives2D (); 142 187 } 143 188 … … 151 196 152 197 void G4OpenGLImmediateSceneHandler::ClearTransientStore () { 198 153 199 G4VSceneHandler::ClearTransientStore (); 200 154 201 // Make sure screen corresponds to graphical database... 155 202 if (fpViewer) { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLImmediateX.cc,v 1.1 2 2006/08/14 12:07:19allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLImmediateX.cc,v 1.13 2007/08/21 14:05:51 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 41 41 #include "G4OpenGLImmediateXViewer.hh" 42 42 #include "G4OpenGLViewerMessenger.hh" 43 #include "G4OpenGLXViewerMessenger.hh"44 43 45 44 G4OpenGLImmediateX::G4OpenGLImmediateX (): … … 50 49 { 51 50 G4OpenGLViewerMessenger::GetInstance(); 52 G4OpenGLXViewerMessenger::GetInstance();53 51 } 54 52 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc
r589 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLQtExportDialog.cc,v 0.1 2007/09/20 15:18:20 garnier$28 // GEANT4 tag $Name: geant4-08-02-patch-01$27 // $Id: G4OpenGLQtExportDialog.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 34 34 #include "G4OpenGLQtExportDialog.hh" 35 35 36 #include < qvariant.h>37 #include < qpushbutton.h>38 #include < qcheckbox.h>39 #include < qlabel.h>40 #include < qcombobox.h>41 #include < qslider.h>42 #include < qlayout.h>43 #include < qgroupbox.h>44 #include < qradiobutton.h>45 #include < qimage.h>46 #include < qlineedit.h>36 #include <QtCore/QVariant.h> 37 #include <QtGui/QPushButton.h> 38 #include <QtGui/QCheckBox.h> 39 #include <QtGui/QLabel.h> 40 #include <QtGui/QComboBox.h> 41 #include <QtGui/QSlider.h> 42 #include <QtGui/QLayout.h> 43 #include <QtGui/QGroupBox.h> 44 #include <QtGui/QRadioButton.h> 45 #include <QtGui/QImage.h> 46 #include <QtGui/QLineEdit.h> 47 47 48 48 G4OpenGLQtExportDialog::G4OpenGLQtExportDialog( … … 57 57 originalWidth = aWidth; 58 58 originalHeight = aHeight; 59 60 // Initializations 61 qualitySlider = NULL; 62 width = NULL; 63 height = NULL; 64 colorButton = NULL; 65 BWButton = NULL; 59 66 60 67 // global layout … … 95 102 // transparencyEPS->setChecked( true ); 96 103 97 color = new QRadioButton("Color");98 BW = new QRadioButton("Grayscale");99 color ->setChecked( true );100 BW ->setChecked( false );104 colorButton = new QRadioButton("Color"); 105 BWButton = new QRadioButton("Grayscale"); 106 colorButton->setChecked( true ); 107 BWButton->setChecked( false ); 101 108 102 109 103 110 // EPSGroupBoxLayout->addWidget(transparencyEPS); 104 EPSGroupBoxLayout->addWidget(color );105 EPSGroupBoxLayout->addWidget(BW );111 EPSGroupBoxLayout->addWidget(colorButton); 112 EPSGroupBoxLayout->addWidget(BWButton); 106 113 EPSGroupBox->setLayout(EPSGroupBoxLayout); 107 114 globalVLayout->addWidget(EPSGroupBox); … … 217 224 int G4OpenGLQtExportDialog::getSliderValue() 218 225 { 226 if (!qualitySlider) return -1; 219 227 return qualitySlider->value(); 220 228 } … … 222 230 int G4OpenGLQtExportDialog::getHeight() 223 231 { 232 if (!height) return -1; 224 233 return height->text().toInt(); 225 234 } … … 227 236 int G4OpenGLQtExportDialog::getWidth() 228 237 { 238 if (!width) return -1; 229 239 return width->text().toInt(); 230 240 } 231 241 232 int G4OpenGLQtExportDialog::getTransparency() 233 { 242 bool G4OpenGLQtExportDialog::getTransparency() 243 { 244 if (!boxTransparency) return -1; 234 245 return boxTransparency->isChecked(); 235 246 } … … 238 249 { 239 250 // Black and white 240 if (!color ->isChecked())251 if (!colorButton->isChecked()) 241 252 return 1; 242 253 // rgb color -
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r589 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLQtViewer.cc,v 1. 17 2006/06/29 21:19:36 gunter Exp $28 // GEANT4 tag $Name: geant4-08-01-patch-01$27 // $Id: G4OpenGLQtViewer.cc,v 1.3 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 50 50 #include "G4UIsession.hh" 51 51 #include "G4UImanager.hh" 52 #include <QtGui/qboxlayout.h> 53 #include <QtGui/qdialog.h> 54 #include <QtGui/qmenu.h> 55 #include <QImageWriter> 56 #include <QMessageBox> 57 #include <QFileDialog.h> 58 #include <QPrinter.h> 59 #include <QPainter.h> 52 #include <QtGui/QApplication.h> 53 #include <QtGui/QBoxLayout.h> 54 #include <QtGui/QDialog.h> 55 #include <QtGui/QMenu.h> 56 #include <QtGui/QImageWriter> 57 #include <QtGui/QMessageBox> 58 #include <QtGui/QFileDialog.h> 59 #include <QtGui/QPrinter.h> 60 #include <QtGui/QPainter.h> 61 #include <QtOpenGL/QGLWidget> 62 #include <QtGui/QDialog> 63 #include <QtGui/QContextMenuEvent> 64 #include <QtGui/QMenu> 65 #include <QtGui/QImage> 66 60 67 61 68 ////////////////////////////////////////////////////////////////////////////// … … 683 690 G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width()); 684 691 if( exportDialog->exec()) { 685 686 printf("rescaling before\n"); 687 // QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ; 688 QImage image = fWindow->grabFrameBuffer(); 689 printf("rescaling after\n"); 692 693 QImage image; 694 // if ((exportDialog->getWidth() !=fWindow->width()) || 695 // (exportDialog->getHeight() !=fWindow->height())) { 690 696 691 692 if ((exportDialog->getWidth() !=fWindow->width()) ||693 (exportDialog->getWidth() !=fWindow->width())) {694 695 697 // rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image 696 698 printf("rescaling\n"); 697 } 698 699 QGLWidget* glResized = fWindow; 700 fWindow->renderPixmap (exportDialog->getWidth()*2,exportDialog->getHeight()*2 ).save("/Users/laurentgarnier/Desktop/zzz.jpg","jpg"); 701 QPixmap * pixmap = new QPixmap(fWindow->renderPixmap (exportDialog->getWidth(),exportDialog->getHeight() )) ; 702 // image = pixmap.toImage(); 703 // glResized->resize(exportDialog->getWidth()*2,exportDialog->getHeight()*2); 704 printf("rescaling after\n"); 705 // image = glResized->grabFrameBuffer(); 706 707 // } else { 708 // image = fWindow->grabFrameBuffer(); 709 // } 699 710 // jpeg format 700 711 if (nomFich.endsWith(".jpg") || -
trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLSceneHandler.cc,v 1. 45 2006/08/30 11:37:34allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLSceneHandler.cc,v 1.51 2007/05/25 15:41:38 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 52 52 #include "G4Transform3D.hh" 53 53 #include "G4Polyline.hh" 54 #include "G4Polymarker.hh" 54 55 #include "G4Text.hh" 55 56 #include "G4Circle.hh" … … 64 65 #include "G4Scene.hh" 65 66 #include "G4VisExtent.hh" 67 #include "G4AttHolder.hh" 66 68 67 69 G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system, 68 70 G4int id, 69 71 const G4String& name): 70 G4VSceneHandler (system, id, name) 72 G4VSceneHandler (system, id, name), 73 fPickName(0), 74 fProcessingPolymarker(false) 71 75 {} 72 76 … … 94 98 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55 95 99 }; 100 101 void G4OpenGLSceneHandler::ClearAndDestroyAtts() 102 { 103 std::map<GLuint, G4AttHolder*>::iterator i; 104 for (i = fPickMap.begin(); i != fPickMap.end(); ++i) delete i->second; 105 fPickMap.clear(); 106 } 107 108 void G4OpenGLSceneHandler::PreAddSolid 109 (const G4Transform3D& objectTransformation, 110 const G4VisAttributes& visAttribs) 111 { 112 G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs); 113 } 114 115 void G4OpenGLSceneHandler::BeginPrimitives 116 (const G4Transform3D& objectTransformation) 117 { 118 G4VSceneHandler::BeginPrimitives (objectTransformation); 119 } 120 121 void G4OpenGLSceneHandler::EndPrimitives () 122 { 123 G4VSceneHandler::EndPrimitives (); 124 } 125 126 void G4OpenGLSceneHandler::BeginPrimitives2D () 127 { 128 G4VSceneHandler::BeginPrimitives2D (); 129 } 130 131 void G4OpenGLSceneHandler::EndPrimitives2D () 132 { 133 G4VSceneHandler::EndPrimitives2D (); 134 } 96 135 97 136 const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron () … … 120 159 if (nPoints <= 0) return; 121 160 161 // Loads G4Atts for picking... 162 if (fpViewer->GetViewParameters().IsPicking()) { 163 G4AttHolder* holder = new G4AttHolder; 164 LoadAtts(line, holder); 165 fPickMap[fPickName] = holder; 166 } 167 122 168 // Note: colour treated in sub-class. 123 169 … … 128 174 glDisable (GL_LIGHTING); 129 175 130 G4double lineWidth = GetLineWidth(line); 176 // Get vis attributes - pick up defaults if none. 177 const G4VisAttributes* pVA = 178 fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ()); 179 180 G4double lineWidth = GetLineWidth(pVA); 131 181 glLineWidth(lineWidth); 132 182 … … 142 192 } 143 193 194 void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 195 { 196 G4int nPoints = polymarker.size (); 197 if (nPoints <= 0) return; 198 199 fProcessingPolymarker = true; 200 201 // Loads G4Atts for picking... 202 if (fpViewer->GetViewParameters().IsPicking()) { 203 G4AttHolder* holder = new G4AttHolder; 204 LoadAtts(polymarker, holder); 205 fPickMap[fPickName] = holder; 206 } 207 208 switch (polymarker.GetMarkerType()) { 209 default: 210 case G4Polymarker::dots: 211 { 212 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) { 213 G4Circle dot (polymarker); 214 dot.SetPosition (polymarker[iPoint]); 215 dot.SetWorldSize (0.); 216 dot.SetScreenSize (0.1); // Very small circle. 217 G4OpenGLSceneHandler::AddPrimitive (dot); 218 } 219 } 220 break; 221 case G4Polymarker::circles: 222 { 223 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) { 224 G4Circle circle (polymarker); 225 circle.SetPosition (polymarker[iPoint]); 226 G4OpenGLSceneHandler::AddPrimitive (circle); 227 } 228 } 229 break; 230 case G4Polymarker::squares: 231 { 232 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) { 233 G4Square square (polymarker); 234 square.SetPosition (polymarker[iPoint]); 235 G4OpenGLSceneHandler::AddPrimitive (square); 236 } 237 } 238 break; 239 } 240 241 fProcessingPolymarker = false; 242 } 243 144 244 void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) { 245 246 // Loads G4Atts for picking... 247 if (fpViewer->GetViewParameters().IsPicking()) { 248 G4AttHolder* holder = new G4AttHolder; 249 LoadAtts(text, holder); 250 fPickMap[fPickName] = holder; 251 } 145 252 146 253 const G4Colour& c = GetTextColour (text); // Picks up default if none. … … 175 282 glDisable (GL_LIGHTING); 176 283 177 glRasterPos3 f(position.x(),position.y(),position.z());284 glRasterPos3d(position.x(),position.y(),position.z()); 178 285 // No action on offset or layout at present. 179 286 glPushAttrib(GL_LIST_BIT); … … 185 292 void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) { 186 293 glEnable (GL_POINT_SMOOTH); 187 AddCircleSquare (circle, 24);294 AddCircleSquare (circle, G4OpenGLBitMapStore::circle); 188 295 } 189 296 190 297 void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) { 191 298 glDisable (GL_POINT_SMOOTH); 192 AddCircleSquare (square, 4);299 AddCircleSquare (square, G4OpenGLBitMapStore::square); 193 300 } 194 301 195 302 void G4OpenGLSceneHandler::AddCircleSquare 196 303 (const G4VMarker& marker, 197 G4int nSides) { 304 G4OpenGLBitMapStore::Shape shape) { 305 306 if (!fProcessingPolymarker) { // Polymarker has already loaded atts. 307 // Loads G4Atts for picking... 308 if (fpViewer->GetViewParameters().IsPicking()) { 309 G4AttHolder* holder = new G4AttHolder; 310 LoadAtts(marker, holder); 311 fPickMap[fPickName] = holder; 312 } 313 } 198 314 199 315 // Note: colour treated in sub-class. … … 205 321 glDisable (GL_LIGHTING); 206 322 207 G4double lineWidth = GetLineWidth(marker); 323 // Get vis attributes - pick up defaults if none. 324 const G4VisAttributes* pVA = 325 fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ()); 326 327 G4double lineWidth = GetLineWidth(pVA); 208 328 glLineWidth(lineWidth); 209 329 210 330 G4VMarker::FillStyle style = marker.GetFillStyle(); 331 332 G4bool filled = false; 333 static G4bool hashedWarned = false; 211 334 212 335 switch (style) { 213 336 case G4VMarker::noFill: 214 337 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); 338 filled = false; 215 339 break; 216 340 217 341 case G4VMarker::hashed: 218 /* 219 G4cout << "Hashed fill style in G4OpenGLSceneHandler." 220 << "\n Not implemented. Using G4VMarker::filled." 221 << G4endl; 222 */ 223 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); 224 glPolygonStipple (fStippleMaskHashed); 225 // See also: 226 // if (style == G4VMarker::filled || style == G4VMarker::hashed)... 227 // (twice) below. 228 break; 342 if (!hashedWarned) { 343 G4cout << "Hashed fill style in G4OpenGLSceneHandler." 344 << "\n Not implemented. Using G4VMarker::filled." 345 << G4endl; 346 hashedWarned = true; 347 } 348 // Maybe use 349 //glPolygonStipple (fStippleMaskHashed); 350 // Drop through to filled... 229 351 230 352 case G4VMarker::filled: 231 353 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); 354 filled = true; 232 355 break; 233 356 234 default:235 G4cout << "Unrecognised fill style in G4OpenGLSceneHandler."236 << "\n Using G4VMarker::filled."237 << G4endl;238 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);239 break;240 241 357 } 242 358 243 359 // A few useful quantities... 244 360 G4Point3D centre = marker.GetPosition(); 245 const G4Vector3D& viewpointDirection =246 fpViewer -> GetViewParameters().GetViewpointDirection();247 const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();248 361 MarkerSizeType sizeType; 249 362 G4double size = GetMarkerSize(marker, sizeType); 250 363 251 // Find "size" of marker in world space (but see note below)... 252 G4double worldSize; 364 // Draw... 253 365 if (sizeType == world) { // Size specified in world coordinates. 254 worldSize = size; 255 } 256 else { // Size specified in screen (window) coordinates. 257 258 // Find window coordinates of centre... 259 GLdouble modelMatrix[16]; 260 glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); 261 G4double projectionMatrix[16]; 262 glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix); 263 GLint viewport[4]; 264 glGetIntegerv(GL_VIEWPORT,viewport); 265 GLdouble winx, winy, winz; 266 gluProject(centre.x(), centre.y(), centre.z(), 267 modelMatrix, projectionMatrix, viewport, 268 &winx, &winy, &winz); 269 270 // Determine ratio window:world... 271 const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit(); 272 const G4Vector3D p = centre + inScreen; 273 GLdouble winDx, winDy, winDz; 274 gluProject(p.x(), p.y(), p.z(), 275 modelMatrix, projectionMatrix, viewport, 276 &winDx, &winDy, &winDz); 277 G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) + 278 std::pow(winy - winDy, 2)); 279 worldSize = size / winWorldRatio; 280 } 281 282 // Draw... 283 DrawXYPolygon (worldSize, centre, nSides); 284 } 285 286 /*************************************************** 287 Note: We have to do it this way round so that when a global 288 transformation is applied, such as with /vis/viewer/set/viewpoint, 289 the markers follow the world coordinates without having to 290 recreate the display lists. The down side is that the markers 291 rotate. The only way to avoid this is to play with the modelview 292 and projection matrices of OpenGL - which I need to think about. 293 For future reference, here is the code to draw in window 294 coordinates; its down side is that markers do not follow global 295 transformations. Some clever stuff is needed. 296 297 ... 298 // Find window coordinates of centre... 299 GLdouble modelMatrix[16]; 300 glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix); 301 G4double projectionMatrix[16]; 302 glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix); 303 GLint viewport[4]; 304 glGetIntegerv(GL_VIEWPORT,viewport); 305 GLdouble winx, winy, winz; 306 gluProject(centre.x(), centre.y(), centre.z(), 307 modelMatrix, projectionMatrix, viewport, 308 &winx, &winy, &winz); 309 310 // Find window size... 311 G4double winSize; 312 if (size) { // Size specified in world coordinates. 313 // Determine size in window coordinates... 314 (Note: improve this by using an inScreen vector as above.) 315 GLdouble winx1, winy1, winz1; 316 gluProject(centre.x() + size, centre.y() + size, centre.z() + size, 317 modelMatrix, projectionMatrix, viewport, 318 &winx1, &winy1, &winz1); 319 winSize = std::sqrt((std::pow(winx - winx1, 2) + 320 std::pow(winy - winy1, 2) + 321 std::pow(winz - winz1, 2)) / 3.); 322 } 323 else { 324 winSize = scale * 325 userSpecified ? marker.GetScreenSize() : def.GetScreenSize(); 326 } 327 328 // Prepare to draw in window coordinates... 329 glMatrixMode (GL_PROJECTION); 330 glPushMatrix(); 331 glLoadIdentity(); 332 gluOrtho2D(GLdouble(viewport[0]), 333 GLdouble(viewport[0] + viewport[2]), 334 GLdouble(viewport[1]), 335 GLdouble(viewport[1] + viewport[3])); 336 glMatrixMode (GL_MODELVIEW); 337 glPushMatrix(); 338 glLoadIdentity(); 339 340 // Draw in window coordinates... 341 DrawScreenPolygon (winSize, G4Point3D(winx, winy, winz), nSides); 342 343 // Re-instate matrices... 344 glMatrixMode (GL_PROJECTION); 345 glPopMatrix(); 346 glMatrixMode (GL_MODELVIEW); 347 glPopMatrix(); 348 ... 349 } 350 351 void G4OpenGLSceneHandler::DrawScreenPolygon 352 (G4double size, 366 367 DrawXYPolygon (shape, size, centre, pVA); 368 369 } else { // Size specified in screen (window) coordinates. 370 371 glRasterPos3d(centre.x(),centre.y(),centre.z()); 372 const GLubyte* marker = 373 G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 374 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 375 glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 376 } 377 } 378 379 void G4OpenGLSceneHandler::DrawXYPolygon 380 (G4OpenGLBitMapStore::Shape shape, 381 G4double size, 353 382 const G4Point3D& centre, 354 G4int nSides) { 355 glBegin (GL_POLYGON); 356 const G4double dPhi = twopi / nSides; 357 const G4double r = size / 2.; 358 G4double phi; 359 G4int i; 360 for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) { 361 G4double x, y, z; 362 x = centre.x() + r * std::cos(phi); 363 y = centre.y() + r * std::sin(phi); 364 z = centre.z(); 365 glVertex3d (x, y, z); 366 } 367 glEnd (); 368 } 369 **********************************************/ 370 371 void G4OpenGLSceneHandler::DrawXYPolygon 372 (G4double size, 373 const G4Point3D& centre, 374 G4int nSides) { 383 const G4VisAttributes* pApplicableVisAtts) 384 { 385 G4int nSides; 386 G4double startPhi; 387 if (shape == G4OpenGLBitMapStore::circle) { 388 nSides = GetNoOfSides(pApplicableVisAtts); 389 startPhi = 0.; 390 } else { 391 nSides = 4; 392 startPhi = -pi / 4.; 393 } 394 375 395 const G4Vector3D& viewpointDirection = 376 396 fpViewer -> GetViewParameters().GetViewpointDirection(); … … 381 401 G4double phi; 382 402 G4int i; 403 383 404 glBegin (GL_POLYGON); 384 for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {405 for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) { 385 406 G4Vector3D r = start; r.rotate(phi, viewpointDirection); 386 407 G4Vector3D p = centre + r; … … 388 409 } 389 410 glEnd (); 411 } 412 413 void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale) 414 { 415 G4VSceneHandler::AddPrimitive(scale); 390 416 } 391 417 … … 398 424 if (polyhedron.GetNoFacets() == 0) return; 399 425 426 // Loads G4Atts for picking... 427 if (fpViewer->GetViewParameters().IsPicking()) { 428 G4AttHolder* holder = new G4AttHolder; 429 LoadAtts(polyhedron, holder); 430 fPickMap[fPickName] = holder; 431 } 432 400 433 // Get vis attributes - pick up defaults if none. 401 434 const G4VisAttributes* pVA = … … 410 443 G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer); 411 444 if (pViewer) transparency_enabled = pViewer->transparency_enabled; 412 const G4Colour& c = GetColour (polyhedron);445 const G4Colour& c = pVA->GetColour(); 413 446 GLfloat materialColour [4]; 414 447 materialColour [0] = c.GetRed (); … … 421 454 } 422 455 423 G4double lineWidth = GetLineWidth(p olyhedron);456 G4double lineWidth = GetLineWidth(pVA); 424 457 glLineWidth(lineWidth); 425 458 … … 681 714 void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) { 682 715 716 // Loads G4Atts for picking... 717 if (fpViewer->GetViewParameters().IsPicking()) { 718 G4AttHolder* holder = new G4AttHolder; 719 LoadAtts(nurb, holder); 720 fPickMap[fPickName] = holder; 721 } 722 683 723 GLUnurbsObj *gl_nurb; 684 724 gl_nurb = gluNewNurbsRenderer (); -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredQt.cc,v 1.1 1 2007/06/24 12:07:19$28 // GEANT4 tag $Name: geant4-08-02-patch-01$27 // $Id: G4OpenGLStoredQt.cc,v 1.1 2007/09/28 14:44:13 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r579 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredQtViewer.cc,v 1. 16 2007/06/25 16:38:13$28 // GEANT4 tag $Name: geant4-08-02-patch-01$27 // $Id: G4OpenGLStoredQtViewer.cc,v 1.2 2007/11/08 17:00:51 lgarnier Exp $ 28 // GEANT4 tag $Name: $ 29 29 // 30 30 // … … 38 38 39 39 #include "G4ios.hh" 40 41 #include <QtGui/QMouseEvent> 42 #include <QtGui/QContextMenuEvent> 40 43 41 44 G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.3 1 2006/08/30 11:43:57 allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.34 2007/04/04 16:50:27 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 46 46 #include "G4PhysicalVolumeModel.hh" 47 47 #include "G4VPhysicalVolume.hh" 48 #include "G4LogicalVolume.hh" 48 49 #include "G4Polyline.hh" 49 50 #include "G4Polymarker.hh" 51 #include "G4Text.hh" 50 52 #include "G4Circle.hh" 51 53 #include "G4Square.hh" 54 #include "G4Polyhedron.hh" 55 #include "G4AttHolder.hh" 52 56 53 57 G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system, … … 56 60 fMemoryForDisplayLists (true), 57 61 fAddPrimitivePreambleNestingDepth (0), 58 fTopPODL (0) 62 fTopPODL (0), 63 fProcessing2D (false) 59 64 {} 60 65 … … 69 74 if (fAddPrimitivePreambleNestingDepth > 1) return; 70 75 76 // Because of our need to control colour of transients (display by 77 // time fading), display lists may only cover a single primitive. 78 // So display list setup is here. 79 80 if (fpViewer->GetViewParameters().IsPicking()) { 81 fPickMap[++fPickName] = 0; 82 } 83 71 84 const G4Colour& c = GetColour (visible); 72 73 if (fMemoryForDisplayLists && fReadyForTransients) {74 75 TO& to = fTOList.back(); // Transient object information.76 77 // Get vis attributes - pick up defaults if none.78 const G4VisAttributes* pVA =79 fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());80 81 // Get time information from vis attributes.82 to.fStartTime = pVA->GetStartTime();83 to.fEndTime = pVA->GetEndTime();84 85 // Keep colour out of (already started) display list so that it86 // can be applied independently.87 glEndList();88 glDeleteLists(fDisplayListId, 1);89 to.fColour = c;90 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());91 glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);92 93 } else {94 95 // Make sure colour is set in other cases.96 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());97 }98 }99 100 void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()101 {102 fAddPrimitivePreambleNestingDepth--;103 }104 105 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)106 {107 AddPrimitivePreamble(polyline);108 G4OpenGLSceneHandler::AddPrimitive(polyline);109 AddPrimitivePostamble();110 }111 112 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)113 {114 AddPrimitivePreamble(circle);115 G4OpenGLSceneHandler::AddPrimitive(circle);116 AddPrimitivePostamble();117 }118 119 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)120 {121 AddPrimitivePreamble(square);122 G4OpenGLSceneHandler::AddPrimitive(square);123 AddPrimitivePostamble();124 }125 126 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)127 {128 AddPrimitivePreamble(polymarker);129 G4OpenGLSceneHandler::AddPrimitive(polymarker);130 AddPrimitivePostamble();131 }132 133 void G4OpenGLStoredSceneHandler::BeginPrimitives134 (const G4Transform3D& objectTransformation) {135 136 G4VSceneHandler::BeginPrimitives (objectTransformation);137 85 138 86 if (fMemoryForDisplayLists) { 139 87 fDisplayListId = glGenLists (1); 140 88 if (!fDisplayListId) { // Could pre-allocate? 141 G4cout << "********************* WARNING! ********************\n" 142 <<"Unable to allocate any more display lists in OpenGL.\n " 143 << " Continuing drawing in IMMEDIATE MODE.\n" 144 << "***************************************************" << G4endl; 89 G4cout << 90 "********************* WARNING! ********************" 91 "\nUnable to allocate any more display lists in OpenGL." 92 "\n Continuing drawing in IMMEDIATE MODE." 93 "\n***************************************************" 94 << G4endl; 145 95 fMemoryForDisplayLists = false; 146 96 } … … 148 98 if (fMemoryForDisplayLists) { 149 99 if (fReadyForTransients) { 150 TO to(fDisplayListId, objectTransformation); 100 TO to(fDisplayListId, *fpObjectTransformation); 101 to.fPickName = fPickName; 102 to.fColour = c; 103 const G4VisAttributes* pVA = 104 fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes()); 105 to.fStartTime = pVA->GetStartTime(); 106 to.fEndTime = pVA->GetEndTime(); 151 107 fTOList.push_back(to); 152 108 glDrawBuffer (GL_FRONT); 153 109 glPushMatrix(); 154 G4OpenGLTransform3D oglt ( objectTransformation);110 G4OpenGLTransform3D oglt (*fpObjectTransformation); 155 111 glMultMatrixd (oglt.GetGLMatrix ()); 112 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 156 113 glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE); 157 114 } 158 115 else { 159 fPOList.push_back(PO(fDisplayListId, objectTransformation)); 116 PO po(fDisplayListId, *fpObjectTransformation); 117 po.fPickName = fPickName; 118 fPOList.push_back(po); 160 119 glNewList (fDisplayListId, GL_COMPILE); 120 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 161 121 } 162 122 } else { 163 123 glDrawBuffer (GL_FRONT); 164 124 glPushMatrix(); 165 G4OpenGLTransform3D oglt ( objectTransformation);125 G4OpenGLTransform3D oglt (*fpObjectTransformation); 166 126 glMultMatrixd (oglt.GetGLMatrix ()); 167 } 168 } 169 170 void G4OpenGLStoredSceneHandler::EndPrimitives () { 127 glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ()); 128 } 129 130 if (fProcessing2D) { 131 // Push current 3D world matrices and load identity to define screen 132 // coordinates... 133 glMatrixMode (GL_PROJECTION); 134 glPushMatrix(); 135 glLoadIdentity(); 136 glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX); 137 glMatrixMode (GL_MODELVIEW); 138 glPushMatrix(); 139 glLoadIdentity(); 140 } 141 } 142 143 void G4OpenGLStoredSceneHandler::AddPrimitivePostamble() 144 { 145 if (fProcessing2D) { 146 // Pop current 3D world matrices back again... 147 glMatrixMode (GL_PROJECTION); 148 glPopMatrix(); 149 glMatrixMode (GL_MODELVIEW); 150 glPopMatrix(); 151 } 152 171 153 if (fMemoryForDisplayLists) { 172 154 glEndList(); … … 177 159 glDrawBuffer (GL_BACK); 178 160 } 179 G4VSceneHandler::EndPrimitives (); 161 fAddPrimitivePreambleNestingDepth--; 162 } 163 164 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline) 165 { 166 AddPrimitivePreamble(polyline); 167 G4OpenGLSceneHandler::AddPrimitive(polyline); 168 AddPrimitivePostamble(); 169 } 170 171 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 172 { 173 AddPrimitivePreamble(polymarker); 174 G4OpenGLSceneHandler::AddPrimitive(polymarker); 175 AddPrimitivePostamble(); 176 } 177 178 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text) 179 { 180 // Note: colour is still handled in 181 // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still 182 // gets into the display list 183 AddPrimitivePreamble(text); 184 G4OpenGLSceneHandler::AddPrimitive(text); 185 AddPrimitivePostamble(); 186 } 187 188 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle) 189 { 190 AddPrimitivePreamble(circle); 191 G4OpenGLSceneHandler::AddPrimitive(circle); 192 AddPrimitivePostamble(); 193 } 194 195 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square) 196 { 197 AddPrimitivePreamble(square); 198 G4OpenGLSceneHandler::AddPrimitive(square); 199 AddPrimitivePostamble(); 200 } 201 202 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale) 203 { 204 // Let base class split into primitives. 205 G4OpenGLSceneHandler::AddPrimitive(scale); 206 } 207 208 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) 209 { 210 // Note: colour is still handled in 211 // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still 212 // gets into the display list 213 AddPrimitivePreamble(polyhedron); 214 G4OpenGLSceneHandler::AddPrimitive(polyhedron); 215 AddPrimitivePostamble(); 216 } 217 218 void G4OpenGLStoredSceneHandler::AddPrimitive (const G4NURBS& nurbs) 219 { 220 // Note: colour is still handled in 221 // G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still 222 // gets into the display list 223 AddPrimitivePreamble(nurbs); 224 G4OpenGLSceneHandler::AddPrimitive(nurbs); 225 AddPrimitivePostamble(); 226 } 227 228 void G4OpenGLStoredSceneHandler::BeginPrimitives 229 (const G4Transform3D& objectTransformation) 230 { 231 G4OpenGLSceneHandler::BeginPrimitives (objectTransformation); 232 233 // Display list setup moved to AddPrimitivePreamble. See notes there. 234 } 235 236 void G4OpenGLStoredSceneHandler::EndPrimitives () 237 { 238 G4OpenGLSceneHandler::EndPrimitives (); 180 239 } 181 240 182 241 void G4OpenGLStoredSceneHandler::BeginPrimitives2D() 183 242 { 184 G4VSceneHandler::BeginPrimitives2D(); 185 186 if (fMemoryForDisplayLists) { 187 fDisplayListId = glGenLists (1); 188 if (!fDisplayListId) { // Could pre-allocate? 189 G4cout << "********************* WARNING! ********************\n" 190 <<"Unable to allocate any more display lists in OpenGL.\n " 191 << " Continuing drawing in IMMEDIATE MODE.\n" 192 << "***************************************************" << G4endl; 193 fMemoryForDisplayLists = false; 194 } 195 } 196 if (fMemoryForDisplayLists) { 197 if (fReadyForTransients) { 198 fTOList.push_back(TO(fDisplayListId)); 199 glDrawBuffer (GL_FRONT); 200 glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE); 201 } 202 else { 203 fPOList.push_back(PO(fDisplayListId)); 204 glNewList (fDisplayListId, GL_COMPILE); 205 } 206 } else { 207 glDrawBuffer (GL_FRONT); 208 } 209 // Push current 3D world matrices and load identity to define screen 210 // coordinates... 211 glMatrixMode (GL_PROJECTION); 212 glPushMatrix(); 213 glLoadIdentity(); 214 glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX); 215 glMatrixMode (GL_MODELVIEW); 216 glPushMatrix(); 217 glLoadIdentity(); 243 G4OpenGLSceneHandler::BeginPrimitives2D(); 244 fProcessing2D = true; 218 245 } 219 246 220 247 void G4OpenGLStoredSceneHandler::EndPrimitives2D () 221 248 { 222 // Pop current 3D world matrices back again... 223 glMatrixMode (GL_PROJECTION); 224 glPopMatrix(); 225 glMatrixMode (GL_MODELVIEW); 226 glPopMatrix(); 227 228 if (fMemoryForDisplayLists) { 229 glEndList(); 230 } 231 if (fReadyForTransients || !fMemoryForDisplayLists) { 232 glFlush (); 233 glDrawBuffer (GL_BACK); 234 } 235 G4VSceneHandler::EndPrimitives2D (); 249 fProcessing2D = false; 250 G4OpenGLSceneHandler::EndPrimitives2D (); 236 251 } 237 252 … … 253 268 " display List for fTopPODL - try OpenGL Immediated mode." 254 269 << G4endl; 255 } 256 else { 270 } else { 257 271 glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); { 258 272 for (size_t i = 0; i < fPOList.size (); i++) { … … 260 274 G4OpenGLTransform3D oglt (fPOList[i].fTransform); 261 275 glMultMatrixd (oglt.GetGLMatrix ()); 276 if (fpViewer->GetViewParameters().IsPicking()) 277 glLoadName(fPOList[i].fPickName); 262 278 glCallList (fPOList[i].fDisplayListId); 263 279 glPopMatrix(); … … 288 304 fPOList.clear (); 289 305 fSolidMap.clear (); 306 ClearAndDestroyAtts(); 290 307 291 308 // ...and clear transient store... … … 375 392 (fSolidMap.find (pSolid) != fSolidMap.end ())) { 376 393 fDisplayListId = fSolidMap [pSolid]; 377 fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation)); 394 PO po(fDisplayListId,*fpObjectTransformation); 395 if (fpViewer->GetViewParameters().IsPicking()) { 396 G4AttHolder* holder = new G4AttHolder; 397 // Load G4Atts from G4VisAttributes, if any... 398 const G4VisAttributes* va = pPVModel->GetCurrentLV()->GetVisAttributes(); 399 if (va) { 400 const std::map<G4String,G4AttDef>* vaDefs = va->GetAttDefs(); 401 if (vaDefs) holder->AddAtts(va->CreateAttValues(), vaDefs); 402 } 403 // Load G4Atts from G4PhysicalVolumeModel... 404 const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs(); 405 if (defs) holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs); 406 fPickMap[++fPickName] = holder; 407 po.fPickName = fPickName; 408 } 409 fPOList.push_back(po); 378 410 } 379 411 else { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
r564 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredViewer.cc,v 1.2 0 2006/10/24 06:23:18allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredViewer.cc,v 1.23 2007/04/04 16:50:27 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 88 88 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) || 89 89 (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) || 90 (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ()) 91 ) {92 return true;93 }94 90 (lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())|| 91 (lastVP.IsPicking () != fVP.IsPicking ()) 92 ) 93 return true; 94 95 95 if (lastVP.IsDensityCulling () && 96 96 (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ())) … … 142 142 } 143 143 144 if (fG4OpenGLStoredSceneHandler.fTopPODL) 144 if (fG4OpenGLStoredSceneHandler.fTopPODL) 145 145 glCallList (fG4OpenGLStoredSceneHandler.fTopPODL); 146 size_t tmp_size = fG4OpenGLStoredSceneHandler.fTOList.size(); 147 G4double bsf = 1.; // Brightness scaling factor. 148 for (size_t i = 0; i < tmp_size; ++i) { 146 147 for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) { 149 148 G4OpenGLStoredSceneHandler::TO& to = 150 149 fG4OpenGLStoredSceneHandler.fTOList[i]; 151 if ( (!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {150 if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) { 152 151 glPushMatrix(); 153 152 G4OpenGLTransform3D oglt (to.fTransform); 154 153 glMultMatrixd (oglt.GetGLMatrix ()); 154 if (fVP.IsPicking()) glLoadName(to.fPickName); 155 155 G4Colour& c = to.fColour; 156 G4double bsf = 1.; // Brightness scaling factor. 156 157 if (fFadeFactor > 0. && to.fEndTime < fEndTime) 157 158 bsf = 1. - fFadeFactor * … … 167 168 168 169 // Display time at "head" of time range, which is fEndTime... 169 if (fDisplayHeadTime && fEndTime < DBL_MAX) {170 if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) { 170 171 glMatrixMode (GL_PROJECTION); 171 172 glPushMatrix(); 172 173 glLoadIdentity(); 173 glOrtho (-1., 1., -1., 1., - DBL_MAX,DBL_MAX);174 glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX); 174 175 glMatrixMode (GL_MODELVIEW); 175 176 glPushMatrix(); … … 183 184 fDisplayHeadTimeBlue)); 184 185 headTimeText.SetVisAttributes(&visAtts); 185 fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText); 186 static_cast<G4OpenGLSceneHandler&>(fSceneHandler). 187 G4OpenGLSceneHandler::AddPrimitive(headTimeText); 186 188 glMatrixMode (GL_PROJECTION); 187 189 glPopMatrix(); … … 191 193 192 194 // Display light front... 193 if (fDisplayLightFront && fEndTime < DBL_MAX) {195 if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) { 194 196 G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light; 195 197 if (lightFrontRadius > 0.) { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.1 8 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.19 2007/04/04 16:50:27 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 123 123 124 124 glFlush (); 125 ::SwapBuffers(fHDC); 125 GLint renderMode; 126 glGetIntegerv(GL_RENDER_MODE, &renderMode); 127 if (renderMode == GL_RENDER) ::SwapBuffers(fHDC); 126 128 127 129 // Empty the Windows message queue : -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredX.cc,v 1.1 3 2006/08/14 12:07:19allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredX.cc,v 1.14 2007/08/21 14:05:51 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 42 42 #include "G4OpenGLStoredXViewer.hh" 43 43 #include "G4OpenGLViewerMessenger.hh" 44 #include "G4OpenGLXViewerMessenger.hh"45 44 46 45 G4OpenGLStoredX::G4OpenGLStoredX (): … … 51 50 { 52 51 G4OpenGLViewerMessenger::GetInstance(); 53 G4OpenGLXViewerMessenger::GetInstance();54 52 } 55 53 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredXViewer.cc,v 1.2 1 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredXViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 126 126 glXWaitGL (); //Wait for effects of all previous OpenGL commands to 127 127 //be propogated before progressing. 128 glXSwapBuffers (dpy, win); 128 GLint renderMode; 129 glGetIntegerv(GL_RENDER_MODE, &renderMode); 130 if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win); 129 131 } 130 132 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $ 28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLStoredXmViewer.cc,v 1.2 1 2006/09/04 12:07:59allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLStoredXmViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 131 131 glXWaitGL (); //Wait for effects of all previous OpenGL commands to 132 132 //be propogated before progressing. 133 glXSwapBuffers (dpy, win); 133 GLint renderMode; 134 glGetIntegerv(GL_RENDER_MODE, &renderMode); 135 if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win); 134 136 } 135 137 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc
r564 r593 26 26 // 27 27 // $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 49 49 *p++ = operator()(k,i); 50 50 } 51 *p++ = 0.; 51 *p++ = 0.; 52 52 } 53 53 m[15] = 1.; -
trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc
r543 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewer.cc,v 1. 29 2006/09/19 16:13:15allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLViewer.cc,v 1.34 2007/05/24 18:27:13 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 46 46 #include "G4Normal3D.hh" 47 47 #include "G4Plane3D.hh" 48 #include "G4AttHolder.hh" 49 #include "G4AttCheck.hh" 50 #include <sstream> 51 52 static const char* gouraudtriangleEPS[] = 53 { 54 "/bd{bind def}bind def /triangle { aload pop setrgbcolor aload pop 5 3", 55 "roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd", 56 "/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2", 57 "index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse", 58 "} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get", 59 "computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get", 60 "computediff1 {true} { 3 copy 2 get 3 1 roll 2 get 3 1 roll 2 get", 61 "computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll", 62 "aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2", 63 "div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4", 64 "-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add", 65 "2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1", 66 "roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3", 67 "1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll", 68 "2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll", 69 "aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array", 70 "astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17", 71 "index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index", 72 "gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6", 73 "array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index", 74 "15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14", 75 "index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3", 76 "roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7", 77 "index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add", 78 "add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd", 79 NULL 80 }; 48 81 49 82 G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene): 50 83 G4VViewer (scene, -1), 84 pointSize (0), 85 print_colour (true), 86 vectored_ps (true), 87 fOpenGLSceneHandler(scene), 51 88 background (G4Colour(0.,0.,0.)), 52 89 transparency_enabled (true), 53 90 antialiasing_enabled (false), 54 91 haloing_enabled (false), 55 fStartTime(- DBL_MAX),56 fEndTime( DBL_MAX),92 fStartTime(-G4OPENGL_DBL_MAX), 93 fEndTime(G4OPENGL_DBL_MAX), 57 94 fFadeFactor(0.), 58 95 fDisplayHeadTime(false), … … 82 119 // glDisable (GL_POLYGON_SMOOTH); 83 120 121 strcpy (print_string, "G4OpenGL.eps"); 84 122 } 85 123 … … 88 126 void G4OpenGLViewer::InitializeGLView () 89 127 { 90 printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");91 128 glClearColor (0.0, 0.0, 0.0, 0.0); 92 129 glClearDepth (1.0); … … 94 131 glDisable (GL_LINE_SMOOTH); 95 132 glDisable (GL_POLYGON_SMOOTH); 96 printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");97 133 } 98 134 … … 275 311 } 276 312 313 void G4OpenGLViewer::Pick(GLdouble x, GLdouble y) 314 { 315 //G4cout << "X: " << x << ", Y: " << y << G4endl; 316 const G4int BUFSIZE = 512; 317 GLuint selectBuffer[BUFSIZE]; 318 glSelectBuffer(BUFSIZE, selectBuffer); 319 glRenderMode(GL_SELECT); 320 glInitNames(); 321 glPushName(0); 322 glMatrixMode(GL_PROJECTION); 323 G4double currentProjectionMatrix[16]; 324 glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix); 325 glPushMatrix(); 326 glLoadIdentity(); 327 GLint viewport[4]; 328 glGetIntegerv(GL_VIEWPORT, viewport); 329 // Define 5x5 pixel pick area 330 gluPickMatrix(x, viewport[3] - y, 5., 5., viewport); 331 glMultMatrixd(currentProjectionMatrix); 332 glMatrixMode(GL_MODELVIEW); 333 DrawView(); 334 GLint hits = glRenderMode(GL_RENDER); 335 if (hits < 0) 336 G4cout << "Too many hits. Zoom in to reduce overlaps." << G4cout; 337 else if (hits > 0) { 338 //G4cout << hits << " hit(s)" << G4endl; 339 GLuint* p = selectBuffer; 340 for (GLint i = 0; i < hits; ++i) { 341 GLuint nnames = *p++; 342 *p++; //OR GLuint zmin = *p++; 343 *p++; //OR GLuint zmax = *p++; 344 //G4cout << "Hit " << i << ": " << nnames << " names" 345 // << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl; 346 for (GLuint j = 0; j < nnames; ++j) { 347 GLuint name = *p++; 348 //G4cout << "Name " << j << ": PickName: " << name << G4endl; 349 std::map<GLuint, G4AttHolder*>::iterator iter = 350 fOpenGLSceneHandler.fPickMap.find(name); 351 if (iter != fOpenGLSceneHandler.fPickMap.end()) { 352 G4AttHolder* attHolder = iter->second; 353 if(attHolder && attHolder->GetAttDefs().size()) { 354 for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) { 355 G4cout << G4AttCheck(attHolder->GetAttValues()[i], 356 attHolder->GetAttDefs()[i]); 357 } 358 } 359 } 360 } 361 G4cout << G4endl; 362 } 363 } 364 glMatrixMode(GL_PROJECTION); 365 glPopMatrix(); 366 glMatrixMode(GL_MODELVIEW); 367 } 368 369 void G4OpenGLViewer::print() { 370 371 // Print vectored PostScript 372 373 G4int size = 5000000; 374 375 GLfloat* feedback_buffer; 376 GLint returned; 377 FILE* file; 378 379 feedback_buffer = new GLfloat[size]; 380 glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer); 381 glRenderMode (GL_FEEDBACK); 382 383 DrawView(); 384 returned = glRenderMode (GL_RENDER); 385 386 if (print_string) { 387 file = fopen (print_string, "w"); 388 if (file) { 389 spewWireframeEPS (file, returned, feedback_buffer, "rendereps"); 390 } else { 391 printf("Could not open %s\n", print_string); 392 } 393 } else { 394 printBuffer (returned, feedback_buffer); 395 } 396 397 delete[] feedback_buffer; 398 } 399 400 void G4OpenGLViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer) 401 { 402 G4int i; 403 404 printf(" "); 405 for (i = 0; i < 7; i++) { 406 printf("%4.2f ", buffer[size - (*count)]); 407 *count = *count - 1; 408 } 409 printf("\n"); 410 } 411 412 void G4OpenGLViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) { 413 414 GLfloat EPS_GOURAUD_THRESHOLD=0.1; 415 416 GLfloat clearColor[4], viewport[4]; 417 GLfloat lineWidth; 418 G4int i; 419 420 glGetFloatv (GL_VIEWPORT, viewport); 421 glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor); 422 glGetFloatv (GL_LINE_WIDTH, &lineWidth); 423 glGetFloatv (GL_POINT_SIZE, &pointSize); 424 425 fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file); 426 fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr); 427 fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]); 428 fputs ("%%EndComments\n", file); 429 fputs ("\n", file); 430 fputs ("gsave\n", file); 431 fputs ("\n", file); 432 433 fputs ("% the gouraudtriangle PostScript fragment below is free\n", file); 434 fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file); 435 fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD); 436 for (i=0; gouraudtriangleEPS[i]; i++) { 437 fprintf (file, "%s\n", gouraudtriangleEPS[i]); 438 } 439 440 fprintf(file, "\n%g setlinewidth\n", lineWidth); 441 442 fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]); 443 fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]); 444 445 spewSortedFeedback (file, size, buffer); 446 447 fputs ("grestore\n\n", file); 448 fputs ("showpage\n", file); 449 450 fclose(file); 451 } 452 453 void G4OpenGLViewer::printBuffer (GLint size, GLfloat* buffer) { 454 455 GLint count; 456 G4int token, nvertices; 457 458 count=size; 459 while(count) { 460 token=G4int (buffer[size-count]); 461 count--; 462 switch (token) { 463 464 case GL_PASS_THROUGH_TOKEN: 465 printf ("GL_PASS_THROUGH_TOKEN\n"); 466 printf (" %4.2f\n", buffer[size-count]); 467 count--; 468 break; 469 470 case GL_POINT_TOKEN: 471 printf ("GL_POINT_TOKEN\n"); 472 print3DcolorVertex (size, &count, buffer); 473 break; 474 475 case GL_LINE_TOKEN: 476 printf ("GL_LINE_TOKEN\n"); 477 print3DcolorVertex (size, &count, buffer); 478 print3DcolorVertex (size, &count, buffer); 479 break; 480 481 case GL_LINE_RESET_TOKEN: 482 printf ("GL_LINE_RESET_TOKEN\n"); 483 print3DcolorVertex (size, &count, buffer); 484 print3DcolorVertex (size, &count, buffer); 485 break; 486 487 case GL_POLYGON_TOKEN: 488 printf ("GL_POLYGON_TOKEN\n"); 489 nvertices=G4int (buffer[size-count]); 490 count--; 491 for (; nvertices>0; nvertices--) { 492 print3DcolorVertex (size, &count, buffer); 493 } 494 } 495 } 496 } 497 498 G4float* G4OpenGLViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) { 499 500 G4int token; 501 G4int nvertices, i; 502 GLfloat red, green, blue, intensity; 503 G4int smooth; 504 GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax; 505 G4int steps; 506 Feedback3Dcolor *vertex; 507 GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.); 508 GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.); 509 510 token=G4int (*loc); 511 loc++; 512 switch (token) { 513 case GL_LINE_RESET_TOKEN: 514 case GL_LINE_TOKEN: 515 vertex=(Feedback3Dcolor*)loc; 516 dr=vertex[1].red - vertex[0].red; 517 dg=vertex[1].green - vertex[0].green; 518 db=vertex[1].blue - vertex[0].blue; 519 520 if (!print_colour) { 521 dr+=(dg+db); 522 dr/=3.0; 523 dg=dr; 524 db=dr; 525 } 526 527 if (dr!=0 || dg!=0 || db!=0) { 528 dx=vertex[1].x - vertex[0].x; 529 dy=vertex[1].y - vertex[0].y; 530 distance=std::sqrt(dx*dx + dy*dy); 531 532 absR=std::fabs(dr); 533 absG=std::fabs(dg); 534 absB=std::fabs(db); 535 536 #define Max(a, b) (((a)>(b))?(a):(b)) 537 538 #define EPS_SMOOTH_LINE_FACTOR 0.06 539 540 colormax=Max(absR, Max(absG, absB)); 541 steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR)); 542 543 xstep=dx/steps; 544 ystep=dy/steps; 545 546 rstep=dr/steps; 547 gstep=dg/steps; 548 bstep=db/steps; 549 550 xnext=vertex[0].x; 551 ynext=vertex[0].y; 552 rnext=vertex[0].red; 553 gnext=vertex[0].green; 554 bnext=vertex[0].blue; 555 556 if (!print_colour) { 557 rnext+=(gnext+bnext); 558 rnext/=3.0; 559 gnext=rnext; 560 bnext=rnext; 561 } 562 563 xnext -= xstep/2.0; 564 ynext -= ystep/2.0; 565 rnext -= rstep/2.0; 566 gnext -= gstep/2.0; 567 bnext -= bstep/2.0; 568 } else { 569 steps=0; 570 } 571 if (print_colour) { 572 fprintf (file, "%g %g %g setrgbcolor\n", 573 vertex[0].red, vertex[0].green, vertex[0].blue); 574 } else { 575 intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0; 576 fprintf (file, "%g %g %g setrgbcolor\n", 577 intensity, intensity, intensity); 578 } 579 fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y); 580 581 for (i=0; i<steps; i++) { 582 583 xnext += xstep; 584 ynext += ystep; 585 rnext += rstep; 586 gnext += gstep; 587 bnext += bstep; 588 589 fprintf (file, "%g %g lineto stroke\n", xnext, ynext); 590 fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext); 591 fprintf (file, "%g %g moveto\n", xnext, ynext); 592 } 593 fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y); 594 595 loc += 14; 596 break; 597 598 case GL_POLYGON_TOKEN: 599 nvertices = G4int (*loc); 600 loc++; 601 vertex=(Feedback3Dcolor*)loc; 602 if (nvertices>0) { 603 red=vertex[0].red; 604 green=vertex[0].green; 605 blue=vertex[0].blue; 606 smooth=0; 607 608 if (!print_colour) { 609 red+=(green+blue); 610 red/=3.0; 611 green=red; 612 blue=red; 613 } 614 615 if (print_colour) { 616 for (i=1; i<nvertices; i++) { 617 if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) { 618 smooth=1; 619 break; 620 } 621 } 622 } else { 623 for (i=1; i<nvertices; i++) { 624 intensity = vertex[i].red + vertex[i].green + vertex[i].blue; 625 intensity/=3.0; 626 if (red!=intensity) { 627 smooth=1; 628 break; 629 } 630 } 631 } 632 633 if (smooth) { 634 G4int triOffset; 635 for (i=0; i<nvertices-2; i++) { 636 triOffset = i*7; 637 fprintf (file, "[%g %g %g %g %g %g]", 638 vertex[0].x, vertex[i+1].x, vertex[i+2].x, 639 vertex[0].y, vertex[i+1].y, vertex[i+2].y); 640 if (print_colour) { 641 fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n", 642 vertex[0].red, vertex[0].green, vertex[0].blue, 643 vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue, 644 vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue); 645 } else { 646 647 intensity = vertex[0].red + vertex[0].green + vertex[0].blue; 648 intensity/=3.0; 649 fprintf (file, " [%g %g %g]", intensity, intensity, intensity); 650 651 intensity = vertex[1].red + vertex[1].green + vertex[1].blue; 652 intensity/=3.0; 653 fprintf (file, " [%g %g %g]", intensity, intensity, intensity); 654 655 intensity = vertex[2].red + vertex[2].green + vertex[2].blue; 656 intensity/=3.0; 657 fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity); 658 } 659 } 660 } else { 661 fprintf (file, "newpath\n"); 662 fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue); 663 fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y); 664 for (i=1; i<nvertices; i++) { 665 fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y); 666 } 667 fprintf (file, "closepath fill\n\n"); 668 } 669 } 670 loc += nvertices*7; 671 break; 672 673 case GL_POINT_TOKEN: 674 vertex=(Feedback3Dcolor*)loc; 675 if (print_colour) { 676 fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue); 677 } else { 678 intensity = vertex[0].red + vertex[0].green + vertex[0].blue; 679 intensity/=3.0; 680 fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity); 681 } 682 fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0); 683 loc += 7; /* Each vertex element in the feedback 684 buffer is 7 GLfloats. */ 685 break; 686 default: 687 /* XXX Left as an excersie to the reader. */ 688 static G4bool spewPrimitiveEPSWarned = false; 689 if (!spewPrimitiveEPSWarned) { 690 std::ostringstream oss; 691 oss << 692 "Incomplete implementation. Unexpected token (" << token << ")." 693 "\n (Seems to be caused by text.)"; 694 G4Exception("G4OpenGLViewer::spewPrimitiveEPS", 695 "Unexpected token", 696 JustWarning, 697 oss.str().c_str()); 698 spewPrimitiveEPSWarned = true; 699 } 700 } 701 return loc; 702 } 703 704 typedef struct G4OpenGLViewerDepthIndex { 705 GLfloat *ptr; 706 GLfloat depth; 707 } DepthIndex; 708 709 extern "C" { 710 int G4OpenGLViewercompare(const void *a, const void *b) 711 { 712 const DepthIndex *p1 = (DepthIndex *) a; 713 const DepthIndex *p2 = (DepthIndex *) b; 714 GLfloat diff = p2->depth - p1->depth; 715 716 if (diff > 0.0) { 717 return 1; 718 } else if (diff < 0.0) { 719 return -1; 720 } else { 721 return 0; 722 } 723 } 724 } 725 726 void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer) 727 { 728 int token; 729 GLfloat *loc, *end; 730 Feedback3Dcolor *vertex; 731 GLfloat depthSum; 732 int nprimitives, item; 733 DepthIndex *prims; 734 int nvertices, i; 735 736 end = buffer + size; 737 738 /* Count how many primitives there are. */ 739 nprimitives = 0; 740 loc = buffer; 741 while (loc < end) { 742 token = int (*loc); 743 loc++; 744 switch (token) { 745 case GL_LINE_TOKEN: 746 case GL_LINE_RESET_TOKEN: 747 loc += 14; 748 nprimitives++; 749 break; 750 case GL_POLYGON_TOKEN: 751 nvertices = int (*loc); 752 loc++; 753 loc += (7 * nvertices); 754 nprimitives++; 755 break; 756 case GL_POINT_TOKEN: 757 loc += 7; 758 nprimitives++; 759 break; 760 default: 761 /* XXX Left as an excersie to the reader. */ 762 static G4bool spewSortedFeedbackWarned = false; 763 if (!spewSortedFeedbackWarned) { 764 std::ostringstream oss; 765 oss << 766 "Incomplete implementation. Unexpected token (" << token << ")." 767 "\n (Seems to be caused by text.)"; 768 G4Exception("G4OpenGLViewer::spewSortedFeedback", 769 "Unexpected token", 770 JustWarning, 771 oss.str().c_str()); 772 spewSortedFeedbackWarned = true; 773 } 774 nprimitives++; 775 } 776 } 777 778 /* Allocate an array of pointers that will point back at 779 primitives in the feedback buffer. There will be one 780 entry per primitive. This array is also where we keep the 781 primitive's average depth. There is one entry per 782 primitive in the feedback buffer. */ 783 prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives); 784 785 item = 0; 786 loc = buffer; 787 while (loc < end) { 788 prims[item].ptr = loc; /* Save this primitive's location. */ 789 token = int (*loc); 790 loc++; 791 switch (token) { 792 case GL_LINE_TOKEN: 793 case GL_LINE_RESET_TOKEN: 794 vertex = (Feedback3Dcolor *) loc; 795 depthSum = vertex[0].z + vertex[1].z; 796 prims[item].depth = depthSum / 2.0; 797 loc += 14; 798 break; 799 case GL_POLYGON_TOKEN: 800 nvertices = int (*loc); 801 loc++; 802 vertex = (Feedback3Dcolor *) loc; 803 depthSum = vertex[0].z; 804 for (i = 1; i < nvertices; i++) { 805 depthSum += vertex[i].z; 806 } 807 prims[item].depth = depthSum / nvertices; 808 loc += (7 * nvertices); 809 break; 810 case GL_POINT_TOKEN: 811 vertex = (Feedback3Dcolor *) loc; 812 prims[item].depth = vertex[0].z; 813 loc += 7; 814 break; 815 default: 816 /* XXX Left as an excersie to the reader. */ 817 assert(1); 818 } 819 item++; 820 } 821 assert(item == nprimitives); 822 823 /* Sort the primitives back to front. */ 824 qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLViewercompare); 825 826 /* Understand that sorting by a primitives average depth 827 doesn't allow us to disambiguate some cases like self 828 intersecting polygons. Handling these cases would require 829 breaking up the primitives. That's too involved for this 830 example. Sorting by depth is good enough for lots of 831 applications. */ 832 833 /* Emit the Encapsulated PostScript for the primitives in 834 back to front order. */ 835 for (item = 0; item < nprimitives; item++) { 836 (void) spewPrimitiveEPS(file, prims[item].ptr); 837 } 838 839 free(prims); 840 } 841 277 842 #endif -
trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLViewerMessenger.cc,v 1. 5 2006/10/24 06:20:42 allisonExp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLViewerMessenger.cc,v 1.9 2007/06/15 09:52:52 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #include "G4OpenGLViewerMessenger.hh" … … 35 35 #include "G4UIcommand.hh" 36 36 #include "G4UIdirectory.hh" 37 #include "G4UIcmdWithoutParameter.hh" 37 38 #include "G4UIcmdWithADouble.hh" 38 39 #include "G4UIcmdWithABool.hh" 40 #include "G4UIcmdWithAString.hh" 39 41 #include "G4VisManager.hh" 40 42 #include <sstream> … … 56 58 fpDirectory = new G4UIdirectory("/vis/ogl/"); 57 59 fpDirectory->SetGuidance("G4OpenGLViewer commands."); 60 61 fpCommandPrintEPS = 62 new G4UIcmdWithoutParameter("/vis/ogl/printEPS", this); 63 fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file."); 64 fpCommandPrintEPS->SetGuidance 65 ("Generates files with names G4OpenGL_n.eps, where n is a sequence" 66 "\nnumber, starting at 0."); 58 67 59 68 fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/"); … … 146 155 fpCommandEndTime->SetGuidance("Set end and range of track time."); 147 156 parameter = new G4UIparameter ("end-time", 'd', omitable = false); 148 parameter->SetDefaultValue( DBL_MAX);157 parameter->SetDefaultValue(G4OPENGL_DBL_MAX); 149 158 fpCommandEndTime->SetParameter(parameter); 150 159 parameter = new G4UIparameter ("end-time-unit", 's', omitable = false); … … 165 174 fpCommandFade->SetDefaultValue(0.); 166 175 176 fpCommandPrintMode = new G4UIcmdWithAString 177 ("/vis/ogl/set/printMode",this); 178 fpCommandPrintMode->SetGuidance("Set print mode"); 179 fpCommandPrintMode->SetParameterName("print_mode",omitable = true); 180 fpCommandPrintMode->SetCandidates("vectored pixmap"); 181 fpCommandPrintMode->SetDefaultValue("vectored"); 182 167 183 fpCommandStartTime = 168 184 new G4UIcommand("/vis/ogl/set/startTime", this); 169 185 fpCommandStartTime->SetGuidance("Set start and range of track time."); 170 186 parameter = new G4UIparameter ("start-time", 'd', omitable = false); 171 parameter->SetDefaultValue(- DBL_MAX);187 parameter->SetDefaultValue(-G4OPENGL_DBL_MAX); 172 188 fpCommandStartTime->SetParameter(parameter); 173 189 parameter = new G4UIparameter ("start-time-unit", 's', omitable = false); … … 192 208 G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger () 193 209 { 210 delete fpCommandPrintMode; 194 211 delete fpCommandTransparency; 195 212 delete fpCommandStartTime; … … 199 216 delete fpCommandDisplayHeadTime; 200 217 delete fpDirectorySet; 218 delete fpCommandPrintEPS; 201 219 delete fpDirectory; 220 221 delete fpInstance; 202 222 } 203 223 … … 226 246 return; 227 247 } 248 249 if (command == fpCommandPrintEPS) 250 { 251 // Keep copy of print_string to preserve Xm behaviour... 252 char* tmp_string = new char[50]; 253 strcpy (tmp_string, pOGLViewer->print_string); 254 // Make new print string... 255 static G4int file_count = 0; 256 std::ostringstream oss; 257 oss << "G4OpenGL_" << file_count++ << ".eps"; 258 strcpy (pOGLViewer->print_string, oss.str().c_str()); 259 // Print eps file... 260 pOGLViewer->print(); 261 // Restore print_string for Xm... 262 strcpy (pOGLViewer->print_string, tmp_string); 263 delete tmp_string; 264 return; 265 } 228 266 229 267 G4OpenGLStoredViewer* pViewer = … … 303 341 } 304 342 343 if (command == fpCommandPrintMode) 344 { 345 if (newValue == "vectored") pViewer->vectored_ps = true; 346 if (newValue == "pixmap") { 347 pViewer->vectored_ps = false; 348 if (pVisManager->GetVerbosity() >= G4VisManager::warnings) { 349 G4cout << 350 "WARNING: Only implemented for X Windows at present." 351 << G4endl; 352 } 353 } 354 } 355 305 356 if (command == fpCommandStartTime) 306 357 { -
trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXViewer.cc,v 1. 34 2006/11/01 11:22:26allison Exp $28 // GEANT4 tag $Name: geant4-0 8-02-patch-01 $27 // $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 77 77 #define USE_STANDARD_COLORMAP 0 78 78 79 static const char* gouraudtriangleEPS[] =80 {81 "/bd{bind def}bind def /triangle { aload pop setrgbcolor aload pop 5 3",82 "roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",83 "/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",84 "index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",85 "} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",86 "computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",87 "computediff1 {true} { 3 copy 2 get 3 1 roll 2 get 3 1 roll 2 get",88 "computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",89 "aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",90 "div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",91 "-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",92 "2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",93 "roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",94 "1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",95 "2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",96 "aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",97 "astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",98 "index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",99 "gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",100 "array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",101 "15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",102 "index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",103 "roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",104 "index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",105 "add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",106 NULL107 };108 109 79 XVisualInfo* G4OpenGLXViewer::vi_single_buffer = 0; 110 80 XVisualInfo* G4OpenGLXViewer::vi_double_buffer = 0; 111 81 112 82 extern "C" { 113 Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {83 static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) { 114 84 return (e->type == MapNotify) && (e->xmap.window == (Window) arg); 115 85 } … … 125 95 //be propagated before progressing. 126 96 glFlush (); 97 98 if (fVP.IsPicking()) { 99 G4cout << 100 "Window activated for picking (left-mouse), exit (middle-mouse)." 101 << G4endl; 102 while (true) { 103 if (XPending(dpy)) { 104 XNextEvent(dpy, &event); 105 if (event.type == ButtonPress && event.xbutton.button == 1) { 106 Pick(event.xbutton.x, event.xbutton.y); 107 } 108 else if (event.type == ButtonPress && event.xbutton.button == 2) break; 109 } 110 } 111 } 127 112 } 128 113 … … 181 166 182 167 if (status == 1) { 168 cmap = 0; 183 169 status = XGetRGBColormaps (dpy, 184 170 XRootWindow (dpy, vi -> screen), … … 187 173 XA_RGB_DEFAULT_MAP); 188 174 if (status == 1) 189 for (i = 0; i < numCmaps; i++) 175 for (i = 0; i < numCmaps; i++) { 190 176 if (standardCmaps[i].visualid == vi -> visualid) { 191 177 cmap = standardCmaps[i].colormap; 192 178 XFree (standardCmaps); 179 break; 193 180 } 181 } 182 if (!cmap) { 183 fViewId = -1; // This flags an error. 184 G4cerr << 185 "G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap." 186 << G4endl; 187 return; 188 } 194 189 G4cout << "Got standard cmap" << G4endl; 195 190 } else { … … 298 293 299 294 // connect the context to a window 300 glXMakeCurrent (dpy, win, cx); 295 Bool success = glXMakeCurrent (dpy, win, cx); 296 if (!success) { 297 fViewId = -1; // This flags an error. 298 G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context." 299 << G4endl; 300 GLint error = GL_NO_ERROR; 301 while ((error = glGetError()) != GL_NO_ERROR) { 302 G4cout << "GL Error: " << gluErrorString(error) << G4endl; 303 } 304 return; 305 } 301 306 302 307 } … … 342 347 G4VViewer (scene, -1), 343 348 G4OpenGLViewer (scene), 344 print_colour (true),345 vectored_ps (true),346 349 vi_immediate (0), 347 vi_stored (0) 350 vi_stored (0), 351 vi (0), 352 cmap (0) 348 353 { 349 350 strcpy (print_string, "G4OpenGL.eps");351 352 354 GetXConnection (); 353 355 if (fViewId < 0) return; … … 432 434 433 435 if (vectored_ps) { 434 G4int size = 5000000; 435 436 GLfloat* feedback_buffer; 437 GLint returned; 438 FILE* file; 439 440 feedback_buffer = new GLfloat[size]; 441 glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer); 442 glRenderMode (GL_FEEDBACK); 443 444 DrawView(); 445 returned = glRenderMode (GL_RENDER); 446 447 if (print_string) { 448 file = fopen (print_string, "w"); 449 if (file) { 450 spewWireframeEPS (file, returned, feedback_buffer, "rendereps"); 451 } else { 452 printf("Could not open %s\n", print_string); 453 } 454 } else { 455 printBuffer (returned, feedback_buffer); 456 } 457 // free (feedback_buffer); 458 delete[] feedback_buffer; 436 437 G4OpenGLViewer::print(); 459 438 460 439 } else { … … 462 441 XVisualInfo* pvi; 463 442 GLXContext pcx = create_GL_print_context(pvi); 443 444 if (!pcx) { 445 G4cout << "Unable to create print context." << G4endl; 446 return; 447 } 448 464 449 GLXContext tmp_cx; 465 450 tmp_cx = cx; … … 480 465 481 466 glXMakeCurrent (dpy, 482 glxpmap,467 win, 483 468 cx); 484 469 … … 486 471 487 472 ClearView (); 473 SetView (); 488 474 DrawView (); 489 475 … … 496 482 497 483 glXMakeCurrent (dpy, 498 glxpmap,484 win, 499 485 cx); 500 486 … … 503 489 } 504 490 505 void G4OpenGLXViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer) 506 { 507 G4int i; 508 509 printf(" "); 510 for (i = 0; i < 7; i++) { 511 printf("%4.2f ", buffer[size - (*count)]); 512 *count = *count - 1; 513 } 514 printf("\n"); 515 } 516 517 void G4OpenGLXViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) { 518 519 GLfloat EPS_GOURAUD_THRESHOLD=0.1; 520 521 GLfloat clearColor[4], viewport[4]; 522 GLfloat lineWidth; 523 G4int i; 524 525 glGetFloatv (GL_VIEWPORT, viewport); 526 glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor); 527 glGetFloatv (GL_LINE_WIDTH, &lineWidth); 528 glGetFloatv (GL_POINT_SIZE, &pointSize); 529 530 fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file); 531 fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr); 532 fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]); 533 fputs ("%%EndComments\n", file); 534 fputs ("\n", file); 535 fputs ("gsave\n", file); 536 fputs ("\n", file); 537 538 fputs ("% the gouraudtriangle PostScript fragment below is free\n", file); 539 fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file); 540 fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD); 541 for (i=0; gouraudtriangleEPS[i]; i++) { 542 fprintf (file, "%s\n", gouraudtriangleEPS[i]); 543 } 544 545 fprintf(file, "\n%g setlinewidth\n", lineWidth); 546 547 fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]); 548 fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]); 549 550 spewSortedFeedback (file, size, buffer); 551 552 fputs ("grestore\n\n", file); 553 fputs ("showpage\n", file); 554 555 fclose(file); 556 } 557 558 void G4OpenGLXViewer::printBuffer (GLint size, GLfloat* buffer) { 559 560 GLint count; 561 G4int token, nvertices; 562 563 count=size; 564 while(count) { 565 token=G4int (buffer[size-count]); 566 count--; 567 switch (token) { 568 569 case GL_PASS_THROUGH_TOKEN: 570 printf ("GL_PASS_THROUGH_TOKEN\n"); 571 printf (" %4.2f\n", buffer[size-count]); 572 count--; 573 break; 574 575 case GL_POINT_TOKEN: 576 printf ("GL_POINT_TOKEN\n"); 577 print3DcolorVertex (size, &count, buffer); 578 break; 579 580 case GL_LINE_TOKEN: 581 printf ("GL_LINE_TOKEN\n"); 582 print3DcolorVertex (size, &count, buffer); 583 print3DcolorVertex (size, &count, buffer); 584 break; 585 586 case GL_LINE_RESET_TOKEN: 587 printf ("GL_LINE_RESET_TOKEN\n"); 588 print3DcolorVertex (size, &count, buffer); 589 print3DcolorVertex (size, &count, buffer); 590 break; 591 592 case GL_POLYGON_TOKEN: 593 printf ("GL_POLYGON_TOKEN\n"); 594 nvertices=G4int (buffer[size-count]); 595 count--; 596 for (; nvertices>0; nvertices--) { 597 print3DcolorVertex (size, &count, buffer); 598 } 599 } 600 } 601 } 602 603 G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) { 604 605 G4int token; 606 G4int nvertices, i; 607 GLfloat red, green, blue, intensity; 608 G4int smooth; 609 GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax; 610 G4int steps; 611 Feedback3Dcolor *vertex; 612 GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.); 613 GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.); 614 615 token=G4int (*loc); 616 loc++; 617 switch (token) { 618 case GL_LINE_RESET_TOKEN: 619 case GL_LINE_TOKEN: 620 vertex=(Feedback3Dcolor*)loc; 621 dr=vertex[1].red - vertex[0].red; 622 dg=vertex[1].green - vertex[0].green; 623 db=vertex[1].blue - vertex[0].blue; 624 625 if (!print_colour) { 626 dr+=(dg+db); 627 dr/=3.0; 628 dg=dr; 629 db=dr; 630 } 631 632 if (dr!=0 || dg!=0 || db!=0) { 633 dx=vertex[1].x - vertex[0].x; 634 dy=vertex[1].y - vertex[0].y; 635 distance=std::sqrt(dx*dx + dy*dy); 636 637 absR=std::fabs(dr); 638 absG=std::fabs(dg); 639 absB=std::fabs(db); 640 641 #define Max(a, b) (((a)>(b))?(a):(b)) 642 643 #define EPS_SMOOTH_LINE_FACTOR 0.06 644 645 colormax=Max(absR, Max(absG, absB)); 646 steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR)); 647 648 xstep=dx/steps; 649 ystep=dy/steps; 650 651 rstep=dr/steps; 652 gstep=dg/steps; 653 bstep=db/steps; 654 655 xnext=vertex[0].x; 656 ynext=vertex[0].y; 657 rnext=vertex[0].red; 658 gnext=vertex[0].green; 659 bnext=vertex[0].blue; 660 661 if (!print_colour) { 662 rnext+=(gnext+bnext); 663 rnext/=3.0; 664 gnext=rnext; 665 bnext=rnext; 666 } 667 668 xnext -= xstep/2.0; 669 ynext -= ystep/2.0; 670 rnext -= rstep/2.0; 671 gnext -= gstep/2.0; 672 bnext -= bstep/2.0; 673 } else { 674 steps=0; 675 } 676 if (print_colour) { 677 fprintf (file, "%g %g %g setrgbcolor\n", 678 vertex[0].red, vertex[0].green, vertex[0].blue); 679 } else { 680 intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0; 681 fprintf (file, "%g %g %g setrgbcolor\n", 682 intensity, intensity, intensity); 683 } 684 fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y); 685 686 for (i=0; i<steps; i++) { 687 688 xnext += xstep; 689 ynext += ystep; 690 rnext += rstep; 691 gnext += gstep; 692 bnext += bstep; 693 694 fprintf (file, "%g %g lineto stroke\n", xnext, ynext); 695 fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext); 696 fprintf (file, "%g %g moveto\n", xnext, ynext); 697 } 698 fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y); 699 700 loc += 14; 701 break; 702 703 case GL_POLYGON_TOKEN: 704 nvertices = G4int (*loc); 705 loc++; 706 vertex=(Feedback3Dcolor*)loc; 707 if (nvertices>0) { 708 red=vertex[0].red; 709 green=vertex[0].green; 710 blue=vertex[0].blue; 711 smooth=0; 712 713 if (!print_colour) { 714 red+=(green+blue); 715 red/=3.0; 716 green=red; 717 blue=red; 718 } 719 720 if (print_colour) { 721 for (i=1; i<nvertices; i++) { 722 if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) { 723 smooth=1; 724 break; 725 } 726 } 727 } else { 728 for (i=1; i<nvertices; i++) { 729 intensity = vertex[i].red + vertex[i].green + vertex[i].blue; 730 intensity/=3.0; 731 if (red!=intensity) { 732 smooth=1; 733 break; 734 } 735 } 736 } 737 738 if (smooth) { 739 G4int triOffset; 740 for (i=0; i<nvertices-2; i++) { 741 triOffset = i*7; 742 fprintf (file, "[%g %g %g %g %g %g]", 743 vertex[0].x, vertex[i+1].x, vertex[i+2].x, 744 vertex[0].y, vertex[i+1].y, vertex[i+2].y); 745 if (print_colour) { 746 fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n", 747 vertex[0].red, vertex[0].green, vertex[0].blue, 748 vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue, 749 vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue); 750 } else { 751 752 intensity = vertex[0].red + vertex[0].green + vertex[0].blue; 753 intensity/=3.0; 754 fprintf (file, " [%g %g %g]", intensity, intensity, intensity); 755 756 intensity = vertex[1].red + vertex[1].green + vertex[1].blue; 757 intensity/=3.0; 758 fprintf (file, " [%g %g %g]", intensity, intensity, intensity); 759 760 intensity = vertex[2].red + vertex[2].green + vertex[2].blue; 761 intensity/=3.0; 762 fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity); 763 } 764 } 765 } else { 766 fprintf (file, "newpath\n"); 767 fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue); 768 fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y); 769 for (i=1; i<nvertices; i++) { 770 fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y); 771 } 772 fprintf (file, "closepath fill\n\n"); 773 } 774 } 775 loc += nvertices*7; 776 break; 777 778 case GL_POINT_TOKEN: 779 vertex=(Feedback3Dcolor*)loc; 780 if (print_colour) { 781 fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue); 782 } else { 783 intensity = vertex[0].red + vertex[0].green + vertex[0].blue; 784 intensity/=3.0; 785 fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity); 786 } 787 fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0); 788 loc += 7; /* Each vertex element in the feedback 789 buffer is 7 GLfloats. */ 790 break; 791 default: 792 /* XXX Left as an excersie to the reader. */ 793 static G4bool spewPrimitiveEPSWarned = false; 794 if (!spewPrimitiveEPSWarned) { 795 std::ostringstream oss; 796 oss << 797 "Incomplete implementation. Unexpected token (" << token << ")." 798 "\n (Seems to be caused by text.)"; 799 G4Exception("G4OpenGLXViewer::spewPrimitiveEPS", 800 "Unexpected token", 801 JustWarning, 802 oss.str().c_str()); 803 spewPrimitiveEPSWarned = true; 804 } 805 } 806 return loc; 807 } 808 809 typedef struct G4OpenGLXViewerDepthIndex { 810 GLfloat *ptr; 811 GLfloat depth; 812 } DepthIndex; 813 814 extern "C" { 815 int G4OpenGLXViewercompare(const void *a, const void *b) 816 { 817 const DepthIndex *p1 = (DepthIndex *) a; 818 const DepthIndex *p2 = (DepthIndex *) b; 819 GLfloat diff = p2->depth - p1->depth; 820 821 if (diff > 0.0) { 822 return 1; 823 } else if (diff < 0.0) { 824 return -1; 825 } else { 826 return 0; 827 } 828 } 829 } 830 831 void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer) 832 { 833 int token; 834 GLfloat *loc, *end; 835 Feedback3Dcolor *vertex; 836 GLfloat depthSum; 837 int nprimitives, item; 838 DepthIndex *prims; 839 int nvertices, i; 840 841 end = buffer + size; 842 843 /* Count how many primitives there are. */ 844 nprimitives = 0; 845 loc = buffer; 846 while (loc < end) { 847 token = int (*loc); 848 loc++; 849 switch (token) { 850 case GL_LINE_TOKEN: 851 case GL_LINE_RESET_TOKEN: 852 loc += 14; 853 nprimitives++; 854 break; 855 case GL_POLYGON_TOKEN: 856 nvertices = int (*loc); 857 loc++; 858 loc += (7 * nvertices); 859 nprimitives++; 860 break; 861 case GL_POINT_TOKEN: 862 loc += 7; 863 nprimitives++; 864 break; 865 default: 866 /* XXX Left as an excersie to the reader. */ 867 static G4bool spewSortedFeedbackWarned = false; 868 if (!spewSortedFeedbackWarned) { 869 std::ostringstream oss; 870 oss << 871 "Incomplete implementation. Unexpected token (" << token << ")." 872 "\n (Seems to be caused by text.)"; 873 G4Exception("G4OpenGLXViewer::spewSortedFeedback", 874 "Unexpected token", 875 JustWarning, 876 oss.str().c_str()); 877 spewSortedFeedbackWarned = true; 878 } 879 nprimitives++; 880 } 881 } 882 883 /* Allocate an array of pointers that will point back at 884 primitives in the feedback buffer. There will be one 885 entry per primitive. This array is also where we keep the 886 primitive's average depth. There is one entry per 887 primitive in the feedback buffer. */ 888 prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives); 889 890 item = 0; 891 loc = buffer; 892 while (loc < end) { 893 prims[item].ptr = loc; /* Save this primitive's location. */ 894 token = int (*loc); 895 loc++; 896 switch (token) { 897 case GL_LINE_TOKEN: 898 case GL_LINE_RESET_TOKEN: 899 vertex = (Feedback3Dcolor *) loc; 900 depthSum = vertex[0].z + vertex[1].z; 901 prims[item].depth = depthSum / 2.0; 902 loc += 14; 903 break; 904 case GL_POLYGON_TOKEN: 905 nvertices = int (*loc); 906 loc++; 907 vertex = (Feedback3Dcolor *) loc; 908 depthSum = vertex[0].z; 909 for (i = 1; i < nvertices; i++) { 910 depthSum += vertex[i].z; 911 } 912 prims[item].depth = depthSum / nvertices; 913 loc += (7 * nvertices); 914 break; 915 case GL_POINT_TOKEN: 916 vertex = (Feedback3Dcolor *) loc; 917 prims[item].depth = vertex[0].z; 918 loc += 7; 919 break; 920 default: 921 /* XXX Left as an excersie to the reader. */ 922 assert(1); 923 } 924 item++; 925 } 926 assert(item == nprimitives); 927 928 /* Sort the primitives back to front. */ 929 qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLXViewercompare); 930 931 /* Understand that sorting by a primitives average depth 932 doesn't allow us to disambiguate some cases like self 933 intersecting polygons. Handling these cases would require 934 breaking up the primitives. That's too involved for this 935 example. Sorting by depth is good enough for lots of 936 applications. */ 937 938 /* Emit the Encapsulated PostScript for the primitives in 939 back to front order. */ 940 for (item = 0; item < nprimitives; item++) { 941 (void) spewPrimitiveEPS(file, prims[item].ptr); 942 } 943 944 free(prims); 945 } 946 947 GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) { 948 949 pvi = glXChooseVisual (dpy, 950 XDefaultScreen (dpy), 951 snglBuf_RGBA); 952 953 if (!pvi) { 954 pvi = glXChooseVisual (dpy, 955 XDefaultScreen (dpy), 956 dblBuf_RGBA); 957 } 958 959 return glXCreateContext (dpy, 960 pvi, 961 NULL, 962 False); 491 GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) { 492 493 GLubyte* buffer; 494 GLint swapbytes, lsbfirst, rowlength; 495 GLint skiprows, skippixels, alignment; 496 GLenum format; 497 int size; 498 499 if (inColor) { 500 format = GL_RGB; 501 size = width*height*3; 502 } else { 503 format = GL_LUMINANCE; 504 size = width*height*1; 505 } 506 507 buffer = new GLubyte[size]; 508 if (buffer == NULL) 509 return NULL; 510 511 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes); 512 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst); 513 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength); 514 515 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows); 516 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels); 517 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment); 518 519 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE); 520 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE); 521 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 522 523 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0); 524 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0); 525 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 526 527 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer); 528 529 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes); 530 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst); 531 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength); 532 533 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows); 534 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels); 535 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment); 536 537 return buffer; 963 538 } 964 539 … … 1040 615 } 1041 616 1042 GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) { 1043 1044 GLubyte* buffer; 1045 GLint swapbytes, lsbfirst, rowlength; 1046 GLint skiprows, skippixels, alignment; 1047 GLenum format; 1048 int size; 1049 1050 if (inColor) { 1051 format = GL_RGB; 1052 size = width*height*3; 1053 } else { 1054 format = GL_LUMINANCE; 1055 size = width*height*1; 1056 } 1057 1058 buffer = new GLubyte[size]; 1059 if (buffer == NULL) 1060 return NULL; 1061 1062 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes); 1063 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst); 1064 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength); 1065 1066 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows); 1067 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels); 1068 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment); 1069 1070 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE); 1071 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE); 1072 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0); 1073 1074 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0); 1075 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0); 1076 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 1077 1078 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer); 1079 1080 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes); 1081 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst); 1082 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength); 1083 1084 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows); 1085 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels); 1086 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment); 1087 1088 return buffer; 617 GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) { 618 619 pvi = glXChooseVisual (dpy, 620 XDefaultScreen (dpy), 621 snglBuf_RGBA); 622 623 if (!pvi) { 624 pvi = glXChooseVisual (dpy, 625 XDefaultScreen (dpy), 626 dblBuf_RGBA); 627 } 628 629 return glXCreateContext (dpy, 630 pvi, 631 NULL, 632 False); 1089 633 } 1090 634 -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Box container class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Framed box container class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Push button class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Radio button class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Separator class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Slider bar class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Text field class. Inherits from G4OpenGLXmVWidgetComponent -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Top level shell class -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif component widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif container widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Virtual base class for all Motif widgets. -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //Base class for all Motif shell widgets -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc
r529 r593 25 25 // 26 26 // 27 // $Id: G4OpenGLXmViewer.cc,v 1.2 3 2006/06/29 21:20:16 gunterExp $28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $27 // $Id: G4OpenGLXmViewer.cc,v 1.24 2007/08/21 14:05:51 allison Exp $ 28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 // … … 616 616 rot_sens_limit (90.), 617 617 pan_sens_limit (100.), 618 rot_sens ( 4.),618 rot_sens (1.), 619 619 wob_sens (20.), 620 620 original_vp(fVP.GetViewpointDirection()), -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 30 30 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER -
trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r529 r593 26 26 // 27 27 // $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $ 28 // GEANT4 tag $Name: geant4-0 8-01-patch-01 $28 // GEANT4 tag $Name: geant4-09-00-ref-01 $ 29 29 // 30 30 //
Note:
See TracChangeset
for help on using the changeset viewer.
