Ignore:
Timestamp:
Nov 9, 2007, 3:32:25 PM (17 years ago)
Author:
garnier
Message:

r627@mac-90108: laurentgarnier | 2007-11-09 07:57:42 +0100
modif dans les includes directives

Location:
trunk/geant4/visualization/OpenGL
Files:
99 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/visualization/OpenGL/GNUmakefile

    r539 r593  
    2828CPPFLAGS += -I$(G4BASE)/intercoms/include
    2929CPPFLAGS += -I$(G4BASE)/interfaces/common/include
    30 CPPFLAGS += -I$(G4BASE)/interfaces/basic/include
    3130CPPFLAGS += -I$(G4BASE)/tracking/include
    3231CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
  • trunk/geant4/visualization/OpenGL/History

    r529 r593  
    1 $Id: History,v 1.82 2006/11/21 16:24:58 allison Exp $
     1$Id: History,v 1.94 2007/08/21 14:05:50 allison Exp $
    22-------------------------------------------------------------------
    33
     
    2020History file for visualization/OpenGL
    2121-------------------------------------
     22
     2321st August 2007  John Allison  (opengl-V09-00-00)
     24- Removed redundant G4OpenGLXViewerMessenger.
     25
     2625th May 2007  John Allison  (opengl-V08-03-03)
     27- G4OpenGLSceneHandler and G4OpenGLXViewerMessenger:
     28  Fixed gcc-4.1.2 compiler warnings.
     29
     30G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
     31
     3225th May 2007  John Allison  (opengl-V08-03-02)
     33- G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
     34
     3524th May 2007  John Allison  (opengl-V08-03-01)
     36- Fixes for SUN.
     37
     3816th 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
     458th 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
     514th 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
     553rd 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
     7025th March 2007  John Allison  (opengl-V08-02-03)
     71- Fix compiler warnings.
     72
     738th 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
     799th 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
     865th 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.
    2290
    239121st November 2006  John Allison  (opengl-V08-01-09)
  • trunk/geant4/visualization/OpenGL/include/G4OpenGL.hh

    r529 r593  
    2424// ********************************************************************
    2525//
    26 // $Id: G4OpenGL.hh,v 1.4 2006/06/29 21:17:36 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-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 $
    2828//
    2929// G.Barrand.
     
    3939#include <GL/glu.h>
    4040
     41#define G4OPENGL_DBL_MAX 1.e308
     42
    4143#endif
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLFontBaseStore.hh

    r529 r593  
    2525//
    2626// $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $
    27 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     27// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2828//
    2929// J.Allison  Apr 2005.
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQt.hh

    r533 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateQtViewer.hh

    r561 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    4040#include "G4OpenGLImmediateViewer.hh"
    4141#include "G4OpenGLQtViewer.hh"
    42 #include <QGLWidget>
     42
     43#include <QtOpenGL/QGLWidget>
    4344
    4445#include "globals.hh"
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateSceneHandler.hh,v 1.11 2006/08/16 10:34:36 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    5959  void EndModeling ();
    6060  void AddPrimitive (const G4Polyline&);
     61  void AddPrimitive (const G4Polymarker&);
     62  void AddPrimitive (const G4Text& text);
    6163  void AddPrimitive (const G4Circle&);
    6264  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&);
    8068  void ClearTransientStore ();
    8169
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateX.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXm.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLImmediateXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtExportDialog.hh

    r586 r593  
    2525//
    2626//
    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:
    2929//
    3030//
     
    3535#define G4OPENGLQTEXPORTDIALOG_HH
    3636
    37 #include <qvariant.h>
    38 #include <qdialog.h>
     37#include <QtGui/QDialog.h>
    3938
    4039class QButtonGroup;
     
    4746class QLineEdit;
    4847
     48/** The G4OpenGLQtExportDialog class provide a Dialog displaying differents options
     49  for each file format
     50 */
    4951class G4OpenGLQtExportDialog : public QDialog
    5052{
     
    5254
    5355public:
    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 */
    5565  ~G4OpenGLQtExportDialog();
    5666
     67  /** @return the value of the slider if format has a slider widget, instead return -1 */
    5768  int getSliderValue();
     69
     70  /** return the new width for file if format has a width widget, instead return -1 */
    5871  int getWidth();
     72
     73  /** return the new height for file if format has a height widget, instead return -1 */
    5974  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 */
    6180  int getNbColor();
    6281
    6382public slots:
     83
     84/** Called by a clic on modify/original size button.This will
     85    invert buttons and hide/unhide size
     86*/
    6487  void changeSizeBox(bool); 
     88
     89  /** Called by changing value in height lineEdit. If ratio is keep, will also change the width
     90   */
    6591  void textWidthChanged(const QString &);
     92
     93  /** Called by changing value in width lineEdit. If ratio is keep, will also change the height
     94   */
    6695  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);
    7196
    7297private:
     
    80105  QSlider * qualitySlider;
    81106  QLabel *formatLabel;
    82   QRadioButton* color,*BW;
     107  QRadioButton* colorButton,*BWButton;
    83108  QRadioButton* original,* modify;
    84109  QLineEdit* height,*width;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLQtViewer.hh

    r588 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    4242#include "G4OpenGLSceneHandler.hh"
    4343
    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
     47class QGLWidget;
     48class QDialog;
     49class QContextMenuEvent;
     50class QMenu;
     51class QImage;
     52class QAction;
    5153
    5254class G4OpenGLSceneHandler;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.hh,v 1.20 2006/08/30 11:37:34 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4545#include "G4VSceneHandler.hh"
    4646#include "G4OpenGLViewer.hh"
     47#include "G4OpenGLBitMapStore.hh"
     48#include <map>
    4749
    48 // Base class for various OpenGLScene classes.
     50class G4AttHolder;
     51
     52// Base class for various OpenGLSceneHandler classes.
    4953class G4OpenGLSceneHandler: public G4VSceneHandler {
    5054
     55  friend class G4OpenGLViewer;
     56
    5157public:
     58  virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
     59  virtual void EndPrimitives ();
     60  virtual void BeginPrimitives2D ();
     61  virtual void EndPrimitives2D ();
    5262  void AddPrimitive (const G4Polyline&);
     63  void AddPrimitive (const G4Polymarker&);
    5364  void AddPrimitive (const G4Text&);
    5465  void AddPrimitive (const G4Circle&);
    5566  void AddPrimitive (const G4Square&);
     67  void AddPrimitive (const G4Scale&);
    5668  void AddPrimitive (const G4Polyhedron&);
    5769  void AddPrimitive (const G4NURBS&);
    58   // Explicitly invoke base class methods to avoid warnings about
    59   // 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   }
    6670
     71  void PreAddSolid (const G4Transform3D& objectTransformation,
     72                    const G4VisAttributes&);
    6773  void AddSolid (const G4Box&);
    6874  void AddSolid (const G4Cons&);
     
    8995  const G4Polyhedron* CreateCutawayPolyhedron ();
    9096
     97  GLuint fPickName;
     98  std::map<GLuint, G4AttHolder*> fPickMap;  // For picking.
     99  void ClearAndDestroyAtts();  // Destroys att holders and clears pick map.
     100
    91101private:
    92102
    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);
    101104
    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);
    105110  // Draws in world coordinates a polygon in the screen plane knowing
    106111  // viewpoint direction and up vector.
    107112
    108113  static const GLubyte fStippleMaskHashed [128];
     114
     115  G4bool fProcessingPolymarker;
    109116};
    110117
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLSceneHandler.icc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQt.hh

    r561 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredQtViewer.hh

    r561 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    4040#include "G4OpenGLStoredViewer.hh"
    4141#include "G4OpenGLQtViewer.hh"
    42 #include <QGLWidget>
    43 #include <QApplication>
    44 #include <QMouseEvent>
    45 #include <QContextMenuEvent>
     42
     43#include <QtOpenGL/QGLWidget>
     44
     45class QMouseEvent;
     46class QContextMenuEvent;
    4647
    4748class G4OpenGLStoredSceneHandler;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredSceneHandler.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.hh,v 1.21 2006/08/30 11:43:57 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    6363  void EndModeling ();
    6464  void AddPrimitive (const G4Polyline&);
     65  void AddPrimitive (const G4Polymarker&);
    6566  void AddPrimitive (const G4Circle&);
    6667  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&);
    8272  void ClearStore ();
    8373  void ClearTransientStore ();
     
    9888  struct PO {
    9989    PO(G4int id, const G4Transform3D& tr = G4Transform3D()):
    100       fDisplayListId(id), fTransform(tr) {}
     90      fDisplayListId(id), fTransform(tr), fPickName(0) {}
    10191    G4int fDisplayListId;
    10292    G4Transform3D fTransform;
     93    GLuint fPickName;
    10394  };
    10495  std::vector<PO> fPOList;
     
    10798  struct TO {
    10899    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) {}
    111102    G4int fDisplayListId;
    112103    G4Transform3D fTransform;
     104    GLuint fPickName;
    113105    G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
    114106    G4Colour fColour;
     
    119111  // A proper implementation would use geometry hierarchy.
    120112  std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap;
     113
     114private:
     115  G4bool fProcessing2D;
    121116};
    122117
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredX.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXm.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLStoredXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLTransform3D.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLViewer.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.hh,v 1.18 2006/09/19 16:13:15 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    3838
    3939#include "G4VViewer.hh"
     40#include "G4OpenGL.hh"
    4041
    4142class G4OpenGLSceneHandler;
     
    6263  void HLRThirdPass ();
    6364  void InitializeGLView ();
     65  void Pick(GLdouble x, GLdouble y);
    6466  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;
    6580  G4Colour background;      //the OpenGL clear colour
    6681  G4bool
     
    8095};
    8196
     97typedef 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
    82107#endif
    83108
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLViewerMessenger.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.hh,v 1.4 2006/09/19 16:14:21 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929
    3030#ifndef G4OPENGLVIEWERMESSENGER_HH
     
    3737class G4UIdirectory;
    3838class G4UIcommand;
     39class G4UIcmdWithoutParameter;
    3940class G4UIcmdWithADouble;
    4041class G4UIcmdWithABool;
     42class G4UIcmdWithAString;
    4143
    4244class G4OpenGLViewerMessenger: public G4UImessenger {
     
    5052  static G4OpenGLViewerMessenger* fpInstance;
    5153  G4UIdirectory* fpDirectory;
     54  G4UIcmdWithoutParameter* fpCommandPrintEPS;
    5255  G4UIdirectory* fpDirectorySet;
    5356  G4UIcommand* fpCommandDisplayHeadTime;
     
    5558  G4UIcommand* fpCommandEndTime;
    5659  G4UIcmdWithADouble* fpCommandFade;
     60  G4UIcmdWithAString* fpCommandPrintMode;
    5761  G4UIcommand* fpCommandStartTime;
    5862  G4UIcmdWithABool* fpCommandTransparency;
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLWin32Viewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXViewer.hh

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXViewer.hh,v 1.26 2006/11/01 11:22:27 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    5353
    5454  friend class G4OpenGLXViewerMessenger;
     55  friend class G4OpenGLXmViewer;
    5556
    5657public:
     
    5960  void SetView ();
    6061  void ShowView ();
    61   void print();
    6262
    6363protected:
     
    6666  virtual void CreateMainWindow ();
    6767  virtual void CreateFontLists ();
     68  void print();
    6869
    6970  static int snglBuf_RGBA[12];
    7071  static int dblBuf_RGBA[13];
    7172
    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/////
    8674  GLubyte* grabPixels (int inColor,
    8775                       unsigned int width,
     
    129117};
    130118
    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 
    141119#endif
    142120
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmBox.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFourArrowButtons.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmFramedBox.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmPushButton.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmRadioButton.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmResources.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSeparator.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmSliderBar.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTextField.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmTopLevelShell.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetComponent.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetContainer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetObject.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmVWidgetShell.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewer.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/include/G4OpenGLXmViewerMessenger.hh

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLFontBaseStore.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQt.cc

    r550 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQt.cc,v 1.11 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: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateQtViewer.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateQtViewer.cc,v 1.16 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: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateSceneHandler.cc

    r554 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4747#include "G4OpenGLTransform3D.hh"
    4848#include "G4Polyline.hh"
     49#include "G4Polymarker.hh"
     50#include "G4Text.hh"
    4951#include "G4Circle.hh"
    5052#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
     56G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler
     57(G4VGraphicsSystem& system,const G4String& name):
     58  G4OpenGLSceneHandler (system, fSceneIdCount++, name)
    5559{}
    5660
     
    6266void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
    6367{
     68  if (fpViewer->GetViewParameters().IsPicking()) {
     69    glLoadName(++fPickName);
     70    fPickMap[fPickName] = 0;
     71  }
     72
    6473  const G4Colour& c = GetColour (visible);
    6574  glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
     
    7281}
    7382
     83void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     84{
     85  AddPrimitivePreamble(polymarker);
     86  G4OpenGLSceneHandler::AddPrimitive(polymarker);
     87}
     88
     89void 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
    7497void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
    7598{
     
    84107}
    85108
     109void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale)
     110{
     111  AddPrimitivePreamble(scale);
     112  G4OpenGLSceneHandler::AddPrimitive(scale);
     113}
     114
     115void 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
     123void 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
    86131void G4OpenGLImmediateSceneHandler::BeginPrimitives
    87132(const G4Transform3D& objectTransformation) {
    88   G4VSceneHandler::BeginPrimitives (objectTransformation);
     133  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
    89134  glPushMatrix();
    90135  G4OpenGLTransform3D oglt (objectTransformation);
     
    110155  glFlush ();
    111156
    112   G4VSceneHandler::EndPrimitives ();
     157  G4OpenGLSceneHandler::EndPrimitives ();
    113158}
    114159
    115160void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
    116161{
    117   G4VSceneHandler::BeginPrimitives2D();
     162  G4OpenGLSceneHandler::BeginPrimitives2D();
    118163
    119164  // Push current 3D world matrices and load identity to define screen
     
    122167  glPushMatrix();
    123168  glLoadIdentity();
    124   glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
     169  glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
    125170  glMatrixMode (GL_MODELVIEW);
    126171  glPushMatrix();
     
    139184  glFlush ();
    140185
    141   G4VSceneHandler::EndPrimitives2D ();
     186  G4OpenGLSceneHandler::EndPrimitives2D ();
    142187}
    143188
     
    151196
    152197void G4OpenGLImmediateSceneHandler::ClearTransientStore () {
     198
    153199  G4VSceneHandler::ClearTransientStore ();
     200
    154201  // Make sure screen corresponds to graphical database...
    155202  if (fpViewer) {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateWin32Viewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateX.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4141#include "G4OpenGLImmediateXViewer.hh"
    4242#include "G4OpenGLViewerMessenger.hh"
    43 #include "G4OpenGLXViewerMessenger.hh"
    4443
    4544G4OpenGLImmediateX::G4OpenGLImmediateX ():
     
    5049{
    5150  G4OpenGLViewerMessenger::GetInstance();
    52   G4OpenGLXViewerMessenger::GetInstance();
    5351}
    5452
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXm.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtExportDialog.cc

    r589 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    3434#include "G4OpenGLQtExportDialog.hh"
    3535
    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>
    4747
    4848G4OpenGLQtExportDialog::G4OpenGLQtExportDialog(
     
    5757  originalWidth = aWidth;
    5858  originalHeight = aHeight;
     59
     60  // Initializations
     61  qualitySlider = NULL;
     62  width = NULL;
     63  height = NULL;
     64  colorButton = NULL;
     65  BWButton = NULL;
    5966
    6067  // global layout
     
    95102    //    transparencyEPS->setChecked( true );
    96103
    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 );
    101108
    102109
    103110    //    EPSGroupBoxLayout->addWidget(transparencyEPS);   
    104     EPSGroupBoxLayout->addWidget(color);   
    105     EPSGroupBoxLayout->addWidget(BW);   
     111    EPSGroupBoxLayout->addWidget(colorButton);   
     112    EPSGroupBoxLayout->addWidget(BWButton);   
    106113    EPSGroupBox->setLayout(EPSGroupBoxLayout);
    107114    globalVLayout->addWidget(EPSGroupBox);
     
    217224int G4OpenGLQtExportDialog::getSliderValue()
    218225{
     226  if (!qualitySlider) return -1;
    219227  return qualitySlider->value();
    220228}
     
    222230int G4OpenGLQtExportDialog::getHeight()
    223231{
     232  if (!height) return -1;
    224233  return height->text().toInt();
    225234}
     
    227236int G4OpenGLQtExportDialog::getWidth()
    228237{
     238  if (!width) return -1;
    229239  return width->text().toInt();
    230240}
    231241
    232 int G4OpenGLQtExportDialog::getTransparency()
    233 {
     242bool G4OpenGLQtExportDialog::getTransparency()
     243{
     244  if (!boxTransparency) return -1;
    234245  return boxTransparency->isChecked();
    235246}
     
    238249{
    239250  // Black and white
    240   if (!color->isChecked())
     251  if (!colorButton->isChecked())
    241252    return 1;
    242253  // rgb color
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc

    r589 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    5050#include "G4UIsession.hh"
    5151#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
    6067
    6168//////////////////////////////////////////////////////////////////////////////
     
    683690  G4OpenGLQtExportDialog* exportDialog= new G4OpenGLQtExportDialog(GLWindow,nomFich,fWindow->height(),fWindow->width());
    684691  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())) {
    690696     
    691    
    692     if ((exportDialog->getWidth() !=fWindow->width()) ||
    693          (exportDialog->getWidth() !=fWindow->width())) {
    694 
    695697      //      rescaleImage(exportDialog->getWidth(),exportDialog->getHeight());// re-scale image
    696698      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      //  }   
    699710    // jpeg format
    700711    if (nomFich.endsWith(".jpg") ||
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLSceneHandler.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    5252#include "G4Transform3D.hh"
    5353#include "G4Polyline.hh"
     54#include "G4Polymarker.hh"
    5455#include "G4Text.hh"
    5556#include "G4Circle.hh"
     
    6465#include "G4Scene.hh"
    6566#include "G4VisExtent.hh"
     67#include "G4AttHolder.hh"
    6668
    6769G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
    6870                              G4int id,
    6971                              const G4String& name):
    70   G4VSceneHandler (system, id, name)
     72  G4VSceneHandler (system, id, name),
     73  fPickName(0),
     74  fProcessingPolymarker(false)
    7175{}
    7276
     
    9498  0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
    9599};
     100
     101void 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
     108void G4OpenGLSceneHandler::PreAddSolid
     109(const G4Transform3D& objectTransformation,
     110 const G4VisAttributes& visAttribs)
     111{
     112  G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
     113}
     114
     115void G4OpenGLSceneHandler::BeginPrimitives
     116(const G4Transform3D& objectTransformation)
     117{
     118  G4VSceneHandler::BeginPrimitives (objectTransformation);
     119}
     120
     121void G4OpenGLSceneHandler::EndPrimitives ()
     122{
     123  G4VSceneHandler::EndPrimitives ();
     124}
     125
     126void G4OpenGLSceneHandler::BeginPrimitives2D ()
     127{
     128  G4VSceneHandler::BeginPrimitives2D ();
     129}
     130
     131void G4OpenGLSceneHandler::EndPrimitives2D ()
     132{
     133  G4VSceneHandler::EndPrimitives2D ();
     134}
    96135
    97136const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
     
    120159  if (nPoints <= 0) return;
    121160
     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
    122168  // Note: colour treated in sub-class.
    123169
     
    128174  glDisable (GL_LIGHTING);
    129175
    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);
    131181  glLineWidth(lineWidth);
    132182
     
    142192}
    143193
     194void 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
    144244void 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  }
    145252
    146253  const G4Colour& c = GetTextColour (text);  // Picks up default if none.
     
    175282  glDisable (GL_LIGHTING);
    176283 
    177   glRasterPos3f(position.x(),position.y(),position.z());
     284  glRasterPos3d(position.x(),position.y(),position.z());
    178285  // No action on offset or layout at present.
    179286  glPushAttrib(GL_LIST_BIT);
     
    185292void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
    186293  glEnable (GL_POINT_SMOOTH);
    187   AddCircleSquare (circle, 24);
     294  AddCircleSquare (circle, G4OpenGLBitMapStore::circle);
    188295}
    189296
    190297void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
    191298  glDisable (GL_POINT_SMOOTH);
    192   AddCircleSquare (square, 4);
     299  AddCircleSquare (square, G4OpenGLBitMapStore::square);
    193300}
    194301
    195302void G4OpenGLSceneHandler::AddCircleSquare
    196303(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  }
    198314
    199315  // Note: colour treated in sub-class.
     
    205321  glDisable (GL_LIGHTING);
    206322 
    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);
    208328  glLineWidth(lineWidth);
    209329
    210330  G4VMarker::FillStyle style = marker.GetFillStyle();
     331
     332  G4bool filled = false;
     333  static G4bool hashedWarned = false;
    211334 
    212335  switch (style) {
    213336  case G4VMarker::noFill:
    214337    glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
     338    filled = false;
    215339    break;
    216340   
    217341  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...
    229351   
    230352  case G4VMarker::filled:
    231353    glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
     354    filled = true;
    232355    break;
    233356   
    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    
    241357  }
    242358
    243359  // A few useful quantities...
    244360  G4Point3D centre = marker.GetPosition();
    245   const G4Vector3D& viewpointDirection =
    246     fpViewer -> GetViewParameters().GetViewpointDirection();
    247   const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
    248361  MarkerSizeType sizeType;
    249362  G4double size = GetMarkerSize(marker, sizeType);
    250363
    251   // Find "size" of marker in world space (but see note below)...
    252   G4double worldSize;
     364  // Draw...
    253365  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
     379void G4OpenGLSceneHandler::DrawXYPolygon
     380(G4OpenGLBitMapStore::Shape shape,
     381 G4double size,
    353382 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
    375395  const G4Vector3D& viewpointDirection =
    376396    fpViewer -> GetViewParameters().GetViewpointDirection();
     
    381401  G4double phi;
    382402  G4int i;
     403
    383404  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) {
    385406    G4Vector3D r = start; r.rotate(phi, viewpointDirection);
    386407    G4Vector3D p = centre + r;
     
    388409  }
    389410  glEnd ();
     411}
     412
     413void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale)
     414{
     415  G4VSceneHandler::AddPrimitive(scale);
    390416}
    391417
     
    398424  if (polyhedron.GetNoFacets() == 0) return;
    399425
     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
    400433  // Get vis attributes - pick up defaults if none.
    401434  const G4VisAttributes* pVA =
     
    410443  G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
    411444  if (pViewer) transparency_enabled = pViewer->transparency_enabled;
    412   const G4Colour& c = GetColour (polyhedron);
     445  const G4Colour& c = pVA->GetColour();
    413446  GLfloat materialColour [4];
    414447  materialColour [0] = c.GetRed ();
     
    421454  }
    422455
    423   G4double lineWidth = GetLineWidth(polyhedron);
     456  G4double lineWidth = GetLineWidth(pVA);
    424457  glLineWidth(lineWidth);
    425458
     
    681714void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
    682715
     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
    683723  GLUnurbsObj *gl_nurb;
    684724  gl_nurb = gluNewNurbsRenderer ();
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQt.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredQt.cc,v 1.11 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: $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc

    r579 r593  
    2525//
    2626//
    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: $
    2929//
    3030//
     
    3838
    3939#include "G4ios.hh"
     40
     41#include <QtGui/QMouseEvent>
     42#include <QtGui/QContextMenuEvent>
    4043
    4144G4OpenGLStoredQtViewer::G4OpenGLStoredQtViewer
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4646#include "G4PhysicalVolumeModel.hh"
    4747#include "G4VPhysicalVolume.hh"
     48#include "G4LogicalVolume.hh"
    4849#include "G4Polyline.hh"
    4950#include "G4Polymarker.hh"
     51#include "G4Text.hh"
    5052#include "G4Circle.hh"
    5153#include "G4Square.hh"
     54#include "G4Polyhedron.hh"
     55#include "G4AttHolder.hh"
    5256
    5357G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
     
    5660fMemoryForDisplayLists (true),
    5761fAddPrimitivePreambleNestingDepth (0),
    58 fTopPODL (0)
     62fTopPODL (0),
     63fProcessing2D (false)
    5964{}
    6065
     
    6974  if (fAddPrimitivePreambleNestingDepth > 1) return;
    7075
     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
    7184  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 it
    86     // 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::BeginPrimitives
    134 (const G4Transform3D& objectTransformation) {
    135  
    136   G4VSceneHandler::BeginPrimitives (objectTransformation);
    13785
    13886  if (fMemoryForDisplayLists) {
    13987    fDisplayListId = glGenLists (1);
    14088    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;
    14595      fMemoryForDisplayLists = false;
    14696    }
     
    14898  if (fMemoryForDisplayLists) {
    14999    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();
    151107      fTOList.push_back(to);
    152108      glDrawBuffer (GL_FRONT);
    153109      glPushMatrix();
    154       G4OpenGLTransform3D oglt (objectTransformation);
     110      G4OpenGLTransform3D oglt (*fpObjectTransformation);
    155111      glMultMatrixd (oglt.GetGLMatrix ());
     112      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    156113      glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
    157114    }
    158115    else {
    159       fPOList.push_back(PO(fDisplayListId, objectTransformation));
     116      PO po(fDisplayListId, *fpObjectTransformation);
     117      po.fPickName = fPickName;
     118      fPOList.push_back(po);
    160119      glNewList (fDisplayListId, GL_COMPILE);
     120      glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
    161121    }
    162122  } else {
    163123    glDrawBuffer (GL_FRONT);
    164124    glPushMatrix();
    165     G4OpenGLTransform3D oglt (objectTransformation);
     125    G4OpenGLTransform3D oglt (*fpObjectTransformation);
    166126    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
     143void 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
    171153  if (fMemoryForDisplayLists) {
    172154    glEndList();
     
    177159    glDrawBuffer (GL_BACK);
    178160  }
    179   G4VSceneHandler::EndPrimitives ();
     161  fAddPrimitivePreambleNestingDepth--;
     162}
     163
     164void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
     165{
     166  AddPrimitivePreamble(polyline);
     167  G4OpenGLSceneHandler::AddPrimitive(polyline);
     168  AddPrimitivePostamble();
     169}
     170
     171void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
     172{
     173  AddPrimitivePreamble(polymarker);
     174  G4OpenGLSceneHandler::AddPrimitive(polymarker);
     175  AddPrimitivePostamble();
     176}
     177
     178void 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
     188void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
     189{
     190  AddPrimitivePreamble(circle);
     191  G4OpenGLSceneHandler::AddPrimitive(circle);
     192  AddPrimitivePostamble();
     193}
     194
     195void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
     196{
     197  AddPrimitivePreamble(square);
     198  G4OpenGLSceneHandler::AddPrimitive(square);
     199  AddPrimitivePostamble();
     200}
     201
     202void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale)
     203{
     204  // Let base class split into primitives.
     205  G4OpenGLSceneHandler::AddPrimitive(scale);
     206}
     207
     208void 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
     218void 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
     228void G4OpenGLStoredSceneHandler::BeginPrimitives
     229(const G4Transform3D& objectTransformation)
     230
     231  G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
     232
     233  // Display list setup moved to AddPrimitivePreamble.  See notes there.
     234}
     235
     236void G4OpenGLStoredSceneHandler::EndPrimitives ()
     237{
     238  G4OpenGLSceneHandler::EndPrimitives ();
    180239}
    181240
    182241void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
    183242{
    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;
    218245}
    219246
    220247void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
    221248{
    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 ();
    236251}
    237252
     
    253268      "  display List for fTopPODL - try OpenGL Immediated mode."
    254269           << G4endl;
    255   }
    256   else {
     270  } else {
    257271    glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
    258272      for (size_t i = 0; i < fPOList.size (); i++) {
     
    260274        G4OpenGLTransform3D oglt (fPOList[i].fTransform);
    261275        glMultMatrixd (oglt.GetGLMatrix ());
     276        if (fpViewer->GetViewParameters().IsPicking())
     277          glLoadName(fPOList[i].fPickName);
    262278        glCallList (fPOList[i].fDisplayListId);
    263279        glPopMatrix();
     
    288304  fPOList.clear ();
    289305  fSolidMap.clear ();
     306  ClearAndDestroyAtts();
    290307
    291308  // ...and clear transient store...
     
    375392        (fSolidMap.find (pSolid) != fSolidMap.end ())) {
    376393      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);
    378410    }
    379411    else {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredViewer.cc

    r564 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    8888      (lastVP.GetNoOfSides ()       != fVP.GetNoOfSides ())       ||
    8989      (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 
    9595  if (lastVP.IsDensityCulling () &&
    9696      (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
     
    142142    }
    143143
    144     if (fG4OpenGLStoredSceneHandler.fTopPODL)
     144    if (fG4OpenGLStoredSceneHandler.fTopPODL) 
    145145      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) {
    149148      G4OpenGLStoredSceneHandler::TO& to =
    150149        fG4OpenGLStoredSceneHandler.fTOList[i];
    151       if ((!(to.fEndTime < fStartTime ))&& (!(to.fStartTime > fEndTime))) {
     150      if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
    152151        glPushMatrix();
    153152        G4OpenGLTransform3D oglt (to.fTransform);
    154153        glMultMatrixd (oglt.GetGLMatrix ());
     154        if (fVP.IsPicking()) glLoadName(to.fPickName);
    155155        G4Colour& c = to.fColour;
     156        G4double bsf = 1.;  // Brightness scaling factor.
    156157        if (fFadeFactor > 0. && to.fEndTime < fEndTime)
    157158          bsf = 1. - fFadeFactor *
     
    167168
    168169  // Display time at "head" of time range, which is fEndTime...
    169   if (fDisplayHeadTime && fEndTime < DBL_MAX) {
     170  if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) {
    170171    glMatrixMode (GL_PROJECTION);
    171172    glPushMatrix();
    172173    glLoadIdentity();
    173     glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
     174    glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
    174175    glMatrixMode (GL_MODELVIEW);
    175176    glPushMatrix();
     
    183184                              fDisplayHeadTimeBlue));
    184185    headTimeText.SetVisAttributes(&visAtts);
    185     fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
     186    static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
     187      G4OpenGLSceneHandler::AddPrimitive(headTimeText);
    186188    glMatrixMode (GL_PROJECTION);
    187189    glPopMatrix();
     
    191193
    192194  // Display light front...
    193   if (fDisplayLightFront && fEndTime < DBL_MAX) {
     195  if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) {
    194196    G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
    195197    if (lightFrontRadius > 0.) {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    123123
    124124  glFlush ();
    125   ::SwapBuffers(fHDC);
     125  GLint renderMode;
     126  glGetIntegerv(GL_RENDER_MODE, &renderMode);
     127  if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
    126128
    127129  // Empty the Windows message queue :
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredX.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4242#include "G4OpenGLStoredXViewer.hh"
    4343#include "G4OpenGLViewerMessenger.hh"
    44 #include "G4OpenGLXViewerMessenger.hh"
    4544
    4645G4OpenGLStoredX::G4OpenGLStoredX ():
     
    5150{
    5251  G4OpenGLViewerMessenger::GetInstance();
    53   G4OpenGLXViewerMessenger::GetInstance();
    5452}
    5553
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    126126  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
    127127                //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); 
    129131}
    130132
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXm.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-02-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    131131  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
    132132                //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); 
    134136}
    135137
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLTransform3D.cc

    r564 r593  
    2626//
    2727// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
     
    4949      *p++ = operator()(k,i);
    5050    }
    51     *p++ = 0.;
     51    *p++ = 0.; 
    5252  }
    5353  m[15] = 1.;
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewer.cc

    r543 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    4646#include "G4Normal3D.hh"
    4747#include "G4Plane3D.hh"
     48#include "G4AttHolder.hh"
     49#include "G4AttCheck.hh"
     50#include <sstream>
     51
     52static 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};
    4881
    4982G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
    5083G4VViewer (scene, -1),
     84pointSize (0),
     85print_colour (true),
     86vectored_ps (true),
     87fOpenGLSceneHandler(scene),
    5188background (G4Colour(0.,0.,0.)),
    5289transparency_enabled (true),
    5390antialiasing_enabled (false),
    5491haloing_enabled (false),
    55 fStartTime(-DBL_MAX),
    56 fEndTime(DBL_MAX),
     92fStartTime(-G4OPENGL_DBL_MAX),
     93fEndTime(G4OPENGL_DBL_MAX),
    5794fFadeFactor(0.),
    5895fDisplayHeadTime(false),
     
    82119  //  glDisable (GL_POLYGON_SMOOTH);
    83120
     121  strcpy (print_string, "G4OpenGL.eps");
    84122}
    85123
     
    88126void G4OpenGLViewer::InitializeGLView ()
    89127{
    90   printf("G4OpenGLViewer::InitializeGLView () VVVVVVVVVVVVVVVVVVVVV \n");
    91128  glClearColor (0.0, 0.0, 0.0, 0.0);
    92129  glClearDepth (1.0);
     
    94131  glDisable (GL_LINE_SMOOTH);
    95132  glDisable (GL_POLYGON_SMOOTH);
    96   printf("G4OpenGLViewer::InitializeGLView () ^^^^^^^^^^^^^^^^^^^^ \n");
    97133
    98134
     
    275311}
    276312
     313void 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
     369void 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
     400void 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
     412void 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
     453void 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
     498G4float* 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
     704typedef struct G4OpenGLViewerDepthIndex {
     705  GLfloat *ptr;
     706  GLfloat depth;
     707} DepthIndex;
     708
     709extern "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
     726void 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
    277842#endif
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929
    3030#include "G4OpenGLViewerMessenger.hh"
     
    3535#include "G4UIcommand.hh"
    3636#include "G4UIdirectory.hh"
     37#include "G4UIcmdWithoutParameter.hh"
    3738#include "G4UIcmdWithADouble.hh"
    3839#include "G4UIcmdWithABool.hh"
     40#include "G4UIcmdWithAString.hh"
    3941#include "G4VisManager.hh"
    4042#include <sstream>
     
    5658  fpDirectory = new G4UIdirectory("/vis/ogl/");
    5759  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.");
    5867
    5968  fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
     
    146155  fpCommandEndTime->SetGuidance("Set end and range of track time.");
    147156  parameter = new G4UIparameter ("end-time", 'd', omitable = false);
    148   parameter->SetDefaultValue(DBL_MAX);
     157  parameter->SetDefaultValue(G4OPENGL_DBL_MAX);
    149158  fpCommandEndTime->SetParameter(parameter);
    150159  parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
     
    165174  fpCommandFade->SetDefaultValue(0.);
    166175
     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
    167183  fpCommandStartTime =
    168184    new G4UIcommand("/vis/ogl/set/startTime", this);
    169185  fpCommandStartTime->SetGuidance("Set start and range of track time.");
    170186  parameter = new G4UIparameter ("start-time", 'd', omitable = false);
    171   parameter->SetDefaultValue(-DBL_MAX);
     187  parameter->SetDefaultValue(-G4OPENGL_DBL_MAX);
    172188  fpCommandStartTime->SetParameter(parameter);
    173189  parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
     
    192208G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
    193209{
     210  delete fpCommandPrintMode;
    194211  delete fpCommandTransparency;
    195212  delete fpCommandStartTime;
     
    199216  delete fpCommandDisplayHeadTime;
    200217  delete fpDirectorySet;
     218  delete fpCommandPrintEPS;
    201219  delete fpDirectory;
     220
     221  delete fpInstance;
    202222}
    203223
     
    226246    return;
    227247  }
     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    }
    228266
    229267  G4OpenGLStoredViewer* pViewer =
     
    303341    }
    304342
     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
    305356  if (command == fpCommandStartTime)
    306357    {
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLWin32Viewer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    7777#define USE_STANDARD_COLORMAP 0
    7878
    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   NULL
    107 };
    108 
    10979XVisualInfo*  G4OpenGLXViewer::vi_single_buffer = 0;
    11080XVisualInfo*  G4OpenGLXViewer::vi_double_buffer = 0;
    11181
    11282extern "C" {
    113   Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
     83  static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
    11484    return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
    11585  }
     
    12595                //be propagated before progressing.
    12696  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  }
    127112}
    128113
     
    181166 
    182167  if (status == 1) {
     168    cmap = 0;
    183169    status = XGetRGBColormaps (dpy,
    184170                               XRootWindow (dpy, vi -> screen),
     
    187173                               XA_RGB_DEFAULT_MAP);
    188174    if (status == 1)
    189       for (i = 0; i < numCmaps; i++)
     175      for (i = 0; i < numCmaps; i++) {
    190176        if (standardCmaps[i].visualid == vi -> visualid) {
    191177          cmap = standardCmaps[i].colormap;
    192178          XFree (standardCmaps);
     179          break;
    193180        }
     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    }
    194189    G4cout << "Got standard cmap" << G4endl;
    195190  } else {
     
    298293
    299294// 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  }
    301306
    302307}
     
    342347G4VViewer (scene, -1),
    343348G4OpenGLViewer (scene),
    344 print_colour (true),
    345 vectored_ps (true),
    346349vi_immediate (0),
    347 vi_stored (0)
     350vi_stored (0),
     351vi (0),
     352cmap (0)
    348353{
    349 
    350   strcpy (print_string, "G4OpenGL.eps");
    351 
    352354  GetXConnection ();
    353355  if (fViewId < 0) return;
     
    432434 
    433435  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();
    459438
    460439  } else {
     
    462441    XVisualInfo* pvi;
    463442    GLXContext pcx = create_GL_print_context(pvi);
     443
     444    if (!pcx) {
     445      G4cout << "Unable to create print context." << G4endl;
     446      return;
     447    }
     448
    464449    GLXContext tmp_cx;
    465450    tmp_cx = cx;
     
    480465   
    481466    glXMakeCurrent (dpy,
    482                     glxpmap,
     467                    win,
    483468                    cx);
    484469   
     
    486471   
    487472    ClearView ();
     473    SetView ();
    488474    DrawView ();
    489475   
     
    496482   
    497483    glXMakeCurrent (dpy,
    498                     glxpmap,
     484                    win,
    499485                    cx);
    500486   
     
    503489}
    504490
    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);
     491GLubyte* 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;
    963538}
    964539
     
    1040615}
    1041616
    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;
     617GLXContext 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);
    1089633}
    1090634
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmBox.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Box container class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmConvenienceRoutines.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFourArrowButtons.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmFramedBox.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Framed box container class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmMainMenubarCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPanningCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmPushButton.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Push button class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRadioButton.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmRotationCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSeparator.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Separator class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmSliderBar.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmStyleCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTextField.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Text field class. Inherits from G4OpenGLXmVWidgetComponent
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmTopLevelShell.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Top level shell class
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetComponent.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif component widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetContainer.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif container widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetObject.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Virtual base class for all Motif widgets.
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmVWidgetShell.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//Base class for all Motif shell widgets
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewer.cc

    r529 r593  
    2525//
    2626//
    27 // $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-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 $
    2929//
    3030//
     
    616616rot_sens_limit (90.),
    617617pan_sens_limit (100.),
    618 rot_sens (4.),
     618rot_sens (1.),
    619619wob_sens (20.),
    620620original_vp(fVP.GetViewpointDirection()),
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmViewerMessenger.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929
    3030#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
  • trunk/geant4/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc

    r529 r593  
    2626//
    2727// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
    28 // GEANT4 tag $Name: geant4-08-01-patch-01 $
     28// GEANT4 tag $Name: geant4-09-00-ref-01 $
    2929//
    3030//
Note: See TracChangeset for help on using the changeset viewer.