Import Geant4 9.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:16:48 +02:00
parent 75c7fd177d
commit a8e9364cea
6592 changed files with 84274 additions and 69292 deletions
+47 -2
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.86 2007/03/27 15:15:12 allison Exp $
$Id: History,v 1.93 2007/05/25 15:41:38 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -19,13 +19,58 @@ committal in the CVS repository !
History file for visualization/OpenGL
-------------------------------------
25th May 2007 John Allison (opengl-V08-03-03)
- G4OpenGLSceneHandler and G4OpenGLXViewerMessenger:
Fixed gcc-4.1.2 compiler warnings.
G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
25th May 2007 John Allison (opengl-V08-03-02)
- G4OpenGLXViewer: Trapped glXMakeCurrent in Initialise function.
24th May 2007 John Allison (opengl-V08-03-01)
- Fixes for SUN.
16th May 2007 John Allison (opengl-V08-03-00)
- Fix compiler warnings on SLC4.
- Bug fixes:
o Correct path /vis/ogl/set/printMode.
o Add SetView to pixmap screen dump ("/vis/ogl/set/printMode pixmap"
and "/vis/ogl/printEPS").
8th May 2007 John Allison (opengl-V08-02-06)
- Moved vectored PostScript printing to G4OpenGLViewer.
- /vis/ogl/printEPS should work for all viewers, including Win32.
- Introduced /vis/ogl/set/printMode vectored|pixmap, currently only
effective on X windows (and still somewhat buggy).
4th April 2007 John Allison (opengl-V08-02-05 - needs visman-V08-02-04)
- Implemented picking for OGLSX ( as well as OGLIX). Hopefully works
for OGL*Win32. Still doesn't work for OGL*Xm.
3rd April 2007 John Allison (opengl-V08-02-04 - needs visman-V08-02-03)
- G4OpenGLStoredSceneHandler:
o Re-organised display lists on a per-primitive basis, i.e., one
display list per primitive. (This is so that, except for text,
the colour - or, rather, intensity - can be brought out of the
display list into the TOList (Transient Object List) and
controlled for the Display-by-Time feature. Previously, if more
than one primitive were drawn between BeginPrimitives and
EndPrimitives, it would finish up all in one display list, colour
commands included. Rationalises and fixes a rare bug in the
Display-by-Time feature - see August 2006.)
o Added AddPrimitive(const G4Polymarker&) so that it is treated as
one primoitive to fit with the above re-organisation.
- Implemented picking for OGLIX.
25th March 2007 John Allison (opengl-V08-02-03)
- Fix compiler warnings.
8th February 2007 John Allison (opengl-V08-02-02)
- Fixed Windows problem with DBL_MAX. (Introduced G4OPENGL_DBL_MAX.)
- G4OpenGLXViewer.cc: Small bug fix in print(). (Context was switched
but not switched back. Not serious, because context was always set
.but not switched back. Not serious, because context was always set
before normal drawing.)
9th January 2007 John Allison (opengl-V08-02-01)
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4OpenGL.hh,v 1.5 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
// G.Barrand.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLBitMapStore.hh,v 1.1 2007/01/09 10:11:16 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// John Allison 6th January 2007
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4OpenGLFontBaseStore.hh,v 1.3 2006/06/29 21:17:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
// J.Allison Apr 2005.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.11 2006/08/16 10:34:36 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLImmediateSceneHandler.hh,v 1.13 2007/04/04 16:50:26 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -58,25 +58,13 @@ public:
void BeginModeling ();
void EndModeling ();
void AddPrimitive (const G4Polyline&);
void AddPrimitive (const G4Polymarker&);
void AddPrimitive (const G4Text& text);
void AddPrimitive (const G4Circle&);
void AddPrimitive (const G4Square&);
// Explicitly invoke base class methods to avoid warnings about
// hiding of base class methods...
void AddPrimitive (const G4Text& text) {
G4OpenGLSceneHandler::AddPrimitive (text);
}
void AddPrimitive (const G4Polyhedron& polyhedron) {
G4OpenGLSceneHandler::AddPrimitive (polyhedron);
}
void AddPrimitive (const G4NURBS& nurbs) {
G4OpenGLSceneHandler::AddPrimitive (nurbs);
}
void AddPrimitive(const G4Polymarker& polymarker) {
G4OpenGLSceneHandler::AddPrimitive (polymarker);
}
void AddPrimitive (const G4Scale& scale) {
G4OpenGLSceneHandler::AddPrimitive (scale);
}
void AddPrimitive (const G4Scale& scale);
void AddPrimitive (const G4Polyhedron&);
void AddPrimitive (const G4NURBS&);
void ClearTransientStore ();
protected:
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateViewer.hh,v 1.9 2006/09/04 12:07:59 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateWin32.hh,v 1.7 2006/06/29 21:17:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// OpenGLImmediateWin32 graphics system factory.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateWin32Viewer.hh,v 1.9 2006/06/29 21:17:46 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class G4OpenGLImmediateWin32Viewer : a class derived from
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateX.hh,v 1.7 2006/06/29 21:17:48 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXm.hh,v 1.7 2006/06/29 21:17:52 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXmViewer.hh,v 1.9 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.hh,v 1.21 2007/01/09 10:11:16 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLSceneHandler.hh,v 1.23 2007/04/04 16:50:26 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 27th March 1996
@@ -45,26 +45,31 @@
#include "G4VSceneHandler.hh"
#include "G4OpenGLViewer.hh"
#include "G4OpenGLBitMapStore.hh"
#include <map>
// Base class for various OpenGLScene classes.
class G4AttHolder;
// Base class for various OpenGLSceneHandler classes.
class G4OpenGLSceneHandler: public G4VSceneHandler {
friend class G4OpenGLViewer;
public:
virtual void BeginPrimitives (const G4Transform3D& objectTransformation);
virtual void EndPrimitives ();
virtual void BeginPrimitives2D ();
virtual void EndPrimitives2D ();
void AddPrimitive (const G4Polyline&);
void AddPrimitive (const G4Polymarker&);
void AddPrimitive (const G4Text&);
void AddPrimitive (const G4Circle&);
void AddPrimitive (const G4Square&);
void AddPrimitive (const G4Scale&);
void AddPrimitive (const G4Polyhedron&);
void AddPrimitive (const G4NURBS&);
// Explicitly invoke base class methods to avoid warnings about
// hiding of base class methods...
void AddPrimitive(const G4Polymarker& polymarker) {
G4VSceneHandler::AddPrimitive (polymarker);
}
void AddPrimitive (const G4Scale& scale) {
G4VSceneHandler::AddPrimitive (scale);
}
void PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes&);
void AddSolid (const G4Box&);
void AddSolid (const G4Cons&);
void AddSolid (const G4Tubs&);
@@ -89,6 +94,10 @@ protected:
const G4Polyhedron* CreateSectionPolyhedron ();
const G4Polyhedron* CreateCutawayPolyhedron ();
GLuint fPickName;
std::map<GLuint, G4AttHolder*> fPickMap; // For picking.
void ClearAndDestroyAtts(); // Destroys att holders and clears pick map.
private:
void AddCircleSquare (const G4VMarker&, G4OpenGLBitMapStore::Shape);
@@ -102,6 +111,8 @@ private:
// viewpoint direction and up vector.
static const GLubyte fStippleMaskHashed [128];
G4bool fProcessingPolymarker;
};
#include "G4OpenGLSceneHandler.icc"
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLSceneHandler.icc,v 1.7 2006/06/29 21:17:58 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 20th January 1998
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.hh,v 1.22 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLStoredSceneHandler.hh,v 1.24 2007/04/04 16:50:26 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -62,23 +62,13 @@ public:
void BeginModeling ();
void EndModeling ();
void AddPrimitive (const G4Polyline&);
void AddPrimitive (const G4Polymarker&);
void AddPrimitive (const G4Circle&);
void AddPrimitive (const G4Square&);
void AddPrimitive (const G4Polymarker& polymarker);
// Explicitly invoke base class methods to avoid warnings about
// hiding of base class methods...
void AddPrimitive (const G4Text& text) {
G4OpenGLSceneHandler::AddPrimitive (text);
}
void AddPrimitive (const G4Polyhedron& polyhedron) {
G4OpenGLSceneHandler::AddPrimitive (polyhedron);
}
void AddPrimitive (const G4NURBS& nurbs) {
G4OpenGLSceneHandler::AddPrimitive (nurbs);
}
void AddPrimitive (const G4Scale& scale) {
G4OpenGLSceneHandler::AddPrimitive (scale);
}
void AddPrimitive (const G4Text&);
void AddPrimitive (const G4Scale&);
void AddPrimitive (const G4Polyhedron&);
void AddPrimitive (const G4NURBS&);
void ClearStore ();
void ClearTransientStore ();
@@ -97,19 +87,21 @@ protected:
GLint fTopPODL; // List which calls the other PODLs.
struct PO {
PO(G4int id, const G4Transform3D& tr = G4Transform3D()):
fDisplayListId(id), fTransform(tr) {}
fDisplayListId(id), fTransform(tr), fPickName(0) {}
G4int fDisplayListId;
G4Transform3D fTransform;
GLuint fPickName;
};
std::vector<PO> fPOList;
// TO = Transparent Object.
struct TO {
TO(G4int id, const G4Transform3D& tr = G4Transform3D()):
fDisplayListId(id), fTransform(tr),
fDisplayListId(id), fTransform(tr), fPickName(0),
fStartTime(-G4OPENGL_DBL_MAX), fEndTime(G4OPENGL_DBL_MAX) {}
G4int fDisplayListId;
G4Transform3D fTransform;
GLuint fPickName;
G4double fStartTime, fEndTime; // Time range (e.g., for trajectory steps).
G4Colour fColour;
};
@@ -118,6 +110,9 @@ protected:
// Stop-gap solution of structure re-use.
// A proper implementation would use geometry hierarchy.
std::map <const G4VSolid*, G4int, std::less <const G4VSolid*> > fSolidMap;
private:
G4bool fProcessing2D;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredViewer.hh,v 1.9 2006/06/29 21:18:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredWin32.hh,v 1.7 2006/06/29 21:18:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// OpenGLStoredWin32 graphics system factory.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredWin32Viewer.hh,v 1.7 2006/06/29 21:18:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class G4OpenGLStoredWin32Viewer : a class derived from
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredX.hh,v 1.7 2006/06/29 21:18:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredXViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredXm.hh,v 1.6 2006/06/29 21:18:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredXmViewer.hh,v 1.7 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLTransform3D.hh,v 1.7 2006/06/29 21:18:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 24th October 1996
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.hh,v 1.18 2006/09/19 16:13:15 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLViewer.hh,v 1.20 2007/05/08 11:04:11 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 27th March 1996
@@ -37,6 +37,7 @@
#define G4OPENGLVIEWER_HH
#include "G4VViewer.hh"
#include "G4OpenGL.hh"
class G4OpenGLSceneHandler;
@@ -61,7 +62,21 @@ protected:
void HLRSecondPass ();
void HLRThirdPass ();
void InitializeGLView ();
void Pick(GLdouble x, GLdouble y);
virtual void CreateFontLists () {}
virtual void print();
//////////////////////////////Vectored PostScript production functions///
void printBuffer(GLint, GLfloat*);
GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
void spewSortedFeedback (FILE*, GLint, GLfloat*);
void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
void print3DcolorVertex(GLint, GLint*, GLfloat*);
G4float pointSize;
char print_string[50];
G4bool print_colour;
G4bool vectored_ps;
G4OpenGLSceneHandler& fOpenGLSceneHandler;
G4Colour background; //the OpenGL clear colour
G4bool
transparency_enabled, //is alpha blending enabled?
@@ -79,6 +94,16 @@ protected:
G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
};
typedef struct G4OpenGLViewerFeedback3Dcolor {
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat red;
GLfloat green;
GLfloat blue;
GLfloat alpha;
} Feedback3Dcolor;
#endif
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewerMessenger.hh,v 1.4 2006/09/19 16:14:21 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLViewerMessenger.hh,v 1.5 2007/05/08 11:04:11 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
#ifndef G4OPENGLVIEWERMESSENGER_HH
#define G4OPENGLVIEWERMESSENGER_HH
@@ -36,8 +36,10 @@
class G4UIdirectory;
class G4UIcommand;
class G4UIcmdWithoutParameter;
class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWithAString;
class G4OpenGLViewerMessenger: public G4UImessenger {
public:
@@ -49,11 +51,13 @@ private:
G4OpenGLViewerMessenger(); // Private constructor.
static G4OpenGLViewerMessenger* fpInstance;
G4UIdirectory* fpDirectory;
G4UIcmdWithoutParameter* fpCommandPrintEPS;
G4UIdirectory* fpDirectorySet;
G4UIcommand* fpCommandDisplayHeadTime;
G4UIcommand* fpCommandDisplayLightFront;
G4UIcommand* fpCommandEndTime;
G4UIcmdWithADouble* fpCommandFade;
G4UIcmdWithAString* fpCommandPrintMode;
G4UIcommand* fpCommandStartTime;
G4UIcmdWithABool* fpCommandTransparency;
};
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLWin32Viewer.hh,v 1.13 2006/06/29 21:18:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewer.hh,v 1.26 2006/11/01 11:22:27 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLXViewer.hh,v 1.27 2007/05/08 11:04:11 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -52,37 +52,25 @@ class G4OpenGLSceneHandler;
class G4OpenGLXViewer: virtual public G4OpenGLViewer {
friend class G4OpenGLXViewerMessenger;
friend class G4OpenGLXmViewer;
public:
G4OpenGLXViewer (G4OpenGLSceneHandler& scene);
virtual ~G4OpenGLXViewer ();
void SetView ();
void ShowView ();
void print();
protected:
void GetXConnection ();
void CreateGLXContext (XVisualInfo* vi);
virtual void CreateMainWindow ();
virtual void CreateFontLists ();
void print();
static int snglBuf_RGBA[12];
static int dblBuf_RGBA[13];
char print_string[50];
G4bool print_colour,
vectored_ps;
//////////////////////////////Vectored PostScript production functions//////////////////////////////
void printBuffer(GLint, GLfloat*);
GLfloat* spewPrimitiveEPS (FILE*, GLfloat*);
void spewSortedFeedback (FILE*, GLint, GLfloat*);
void spewWireframeEPS (FILE*, GLint, GLfloat*, const char*);
void print3DcolorVertex(GLint, GLint*, GLfloat*);
G4float pointSize;
//////////////////////////////Pixmap (screen dump) production functions//////////////////////////////
//////////////////////////////Pixmap (screen dump) production functions/////
GLubyte* grabPixels (int inColor,
unsigned int width,
unsigned int height);
@@ -128,16 +116,6 @@ private:
G4OpenGLXViewer& operator = (const G4OpenGLXViewer&);
};
typedef struct G4OpenGLXViewerFeedback3Dcolor {
GLfloat x;
GLfloat y;
GLfloat z;
GLfloat red;
GLfloat green;
GLfloat blue;
GLfloat alpha;
} Feedback3Dcolor;
#endif
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewerMessenger.hh,v 1.2 2006/11/01 11:22:26 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLXViewerMessenger.hh,v 1.3 2007/05/08 11:04:11 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
#ifdef G4VIS_BUILD_OPENGLX_DRIVER
@@ -38,7 +38,6 @@
class G4OpenGLXViewer;
class G4UIdirectory;
class G4UIcmdWithoutParameter;
class G4OpenGLXViewerMessenger: public G4UImessenger {
public:
@@ -50,7 +49,7 @@ private:
G4OpenGLXViewerMessenger(); // Private constructor.
static G4OpenGLXViewerMessenger* fpInstance;
G4UIdirectory* fpDirectory;
G4UIcmdWithoutParameter* fpCommandPrintEPS;
G4UIdirectory* fpDirectorySet;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmBox.hh,v 1.7 2006/06/29 21:18:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Box container class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmFourArrowButtons.hh,v 1.6 2006/06/29 21:18:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmFramedBox.hh,v 1.7 2006/06/29 21:18:28 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Framed box container class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmPushButton.hh,v 1.7 2006/06/29 21:18:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmRadioButton.hh,v 1.7 2006/06/29 21:18:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmResources.hh,v 1.5 2006/06/29 21:18:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Default resources file for GEANT4 OpenGL Motif windows.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmSeparator.hh,v 1.6 2006/06/29 21:18:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmSliderBar.hh,v 1.7 2006/06/29 21:18:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmTextField.hh,v 1.7 2006/06/29 21:18:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmTopLevelShell.hh,v 1.6 2006/06/29 21:18:42 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Top level shell class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetComponent.hh,v 1.6 2006/06/29 21:18:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Base class for all Motif component widgets
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetContainer.hh,v 1.6 2006/06/29 21:18:46 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Base class for all Motif container widgets
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetObject.hh,v 1.6 2006/06/29 21:18:48 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Virtual base class for all Motif widgets.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetShell.hh,v 1.6 2006/06/29 21:18:50 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
//Base class for all Motif window widgets (shells)
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmViewer.hh,v 1.10 2006/06/29 21:18:52 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmViewerMessenger.hh,v 1.4 2006/06/29 21:18:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLBitMapStore.cc,v 1.2 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLBitMapStore.cc,v 1.3 2007/04/04 16:50:26 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// John Allison 6th January 2007
@@ -45,7 +45,7 @@ void SetBit(G4int i, G4int j, GLubyte* bitmap, G4int byteColumns)
const GLubyte* GetBitMap(Shape shape, G4double& size, G4bool filled)
{
// Rationalise size
G4int bitSize = std::abs(size) + 0.49;
G4int bitSize = G4int(std::abs(size) + 0.49);
if (bitSize < 1) bitSize = 1;
// Modify size in calling function (passed by reference).
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLFontBaseStore.cc,v 1.3 2006/06/29 21:18:56 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
#include "G4OpenGLFontBaseStore.hh"
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.25 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.27 2007/04/04 16:50:26 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -46,12 +46,16 @@
#include "G4OpenGLTransform3D.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4Text.hh"
#include "G4Circle.hh"
#include "G4Square.hh"
#include "G4Scale.hh"
#include "G4Polyhedron.hh"
G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler (G4VGraphicsSystem& system,
const G4String& name):
G4OpenGLSceneHandler (system, fSceneIdCount++, name)
G4OpenGLImmediateSceneHandler::G4OpenGLImmediateSceneHandler
(G4VGraphicsSystem& system,const G4String& name):
G4OpenGLSceneHandler (system, fSceneIdCount++, name)
{}
G4OpenGLImmediateSceneHandler::~G4OpenGLImmediateSceneHandler ()
@@ -61,6 +65,11 @@ G4OpenGLImmediateSceneHandler::~G4OpenGLImmediateSceneHandler ()
void G4OpenGLImmediateSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
{
if (fpViewer->GetViewParameters().IsPicking()) {
glLoadName(++fPickName);
fPickMap[fPickName] = 0;
}
const G4Colour& c = GetColour (visible);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
}
@@ -71,6 +80,20 @@ void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyline& polyline)
G4OpenGLSceneHandler::AddPrimitive(polyline);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
{
AddPrimitivePreamble(polymarker);
G4OpenGLSceneHandler::AddPrimitive(polymarker);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Text& text)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4Text&).
AddPrimitivePreamble(text);
G4OpenGLSceneHandler::AddPrimitive(text);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Circle& circle)
{
AddPrimitivePreamble(circle);
@@ -83,9 +106,31 @@ void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Square& square)
G4OpenGLSceneHandler::AddPrimitive(square);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Scale& scale)
{
AddPrimitivePreamble(scale);
G4OpenGLSceneHandler::AddPrimitive(scale);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&).
AddPrimitivePreamble(polyhedron);
G4OpenGLSceneHandler::AddPrimitive(polyhedron);
}
void G4OpenGLImmediateSceneHandler::AddPrimitive (const G4NURBS& nurbs)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&).
AddPrimitivePreamble(nurbs);
G4OpenGLSceneHandler::AddPrimitive(nurbs);
}
void G4OpenGLImmediateSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
G4VSceneHandler::BeginPrimitives (objectTransformation);
G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
glPushMatrix();
G4OpenGLTransform3D oglt (objectTransformation);
@@ -109,12 +154,12 @@ void G4OpenGLImmediateSceneHandler::EndPrimitives ()
// See all primitives immediately...
glFlush ();
G4VSceneHandler::EndPrimitives ();
G4OpenGLSceneHandler::EndPrimitives ();
}
void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
{
G4VSceneHandler::BeginPrimitives2D();
G4OpenGLSceneHandler::BeginPrimitives2D();
// Push current 3D world matrices and load identity to define screen
// coordinates...
@@ -138,7 +183,7 @@ void G4OpenGLImmediateSceneHandler::EndPrimitives2D()
// See all primitives immediately...
glFlush ();
G4VSceneHandler::EndPrimitives2D ();
G4OpenGLSceneHandler::EndPrimitives2D ();
}
void G4OpenGLImmediateSceneHandler::BeginModeling () {
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateViewer.cc,v 1.8 2006/09/04 12:07:59 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateWin32.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// OpenGLImmediateWin32 graphics system factory.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateX.cc,v 1.12 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 27th March 1996
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXViewer.cc,v 1.16 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXm.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLImmediateXmViewer.cc,v 1.17 2006/07/03 16:38:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLSceneHandler.cc,v 1.48 2007/03/27 15:15:12 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLSceneHandler.cc,v 1.51 2007/05/25 15:41:38 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 27th March 1996
@@ -51,6 +51,7 @@
#include "G4Normal3D.hh"
#include "G4Transform3D.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4Text.hh"
#include "G4Circle.hh"
#include "G4Square.hh"
@@ -63,11 +64,14 @@
#include "G4VSolid.hh"
#include "G4Scene.hh"
#include "G4VisExtent.hh"
#include "G4AttHolder.hh"
G4OpenGLSceneHandler::G4OpenGLSceneHandler (G4VGraphicsSystem& system,
G4int id,
const G4String& name):
G4VSceneHandler (system, id, name)
G4VSceneHandler (system, id, name),
fPickName(0),
fProcessingPolymarker(false)
{}
G4OpenGLSceneHandler::~G4OpenGLSceneHandler ()
@@ -94,6 +98,41 @@ const GLubyte G4OpenGLSceneHandler::fStippleMaskHashed [128] = {
0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
};
void G4OpenGLSceneHandler::ClearAndDestroyAtts()
{
std::map<GLuint, G4AttHolder*>::iterator i;
for (i = fPickMap.begin(); i != fPickMap.end(); ++i) delete i->second;
fPickMap.clear();
}
void G4OpenGLSceneHandler::PreAddSolid
(const G4Transform3D& objectTransformation,
const G4VisAttributes& visAttribs)
{
G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
}
void G4OpenGLSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation)
{
G4VSceneHandler::BeginPrimitives (objectTransformation);
}
void G4OpenGLSceneHandler::EndPrimitives ()
{
G4VSceneHandler::EndPrimitives ();
}
void G4OpenGLSceneHandler::BeginPrimitives2D ()
{
G4VSceneHandler::BeginPrimitives2D ();
}
void G4OpenGLSceneHandler::EndPrimitives2D ()
{
G4VSceneHandler::EndPrimitives2D ();
}
const G4Polyhedron* G4OpenGLSceneHandler::CreateSectionPolyhedron ()
{
// Clipping done in G4OpenGLViewer::SetView.
@@ -119,6 +158,13 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
G4int nPoints = line.size ();
if (nPoints <= 0) return;
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(line, holder);
fPickMap[fPickName] = holder;
}
// Note: colour treated in sub-class.
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
@@ -145,8 +191,65 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
glEnd ();
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
{
G4int nPoints = polymarker.size ();
if (nPoints <= 0) return;
fProcessingPolymarker = true;
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(polymarker, holder);
fPickMap[fPickName] = holder;
}
switch (polymarker.GetMarkerType()) {
default:
case G4Polymarker::dots:
{
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
G4Circle dot (polymarker);
dot.SetPosition (polymarker[iPoint]);
dot.SetWorldSize (0.);
dot.SetScreenSize (0.1); // Very small circle.
G4OpenGLSceneHandler::AddPrimitive (dot);
}
}
break;
case G4Polymarker::circles:
{
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
G4Circle circle (polymarker);
circle.SetPosition (polymarker[iPoint]);
G4OpenGLSceneHandler::AddPrimitive (circle);
}
}
break;
case G4Polymarker::squares:
{
for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) {
G4Square square (polymarker);
square.SetPosition (polymarker[iPoint]);
G4OpenGLSceneHandler::AddPrimitive (square);
}
}
break;
}
fProcessingPolymarker = false;
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(text, holder);
fPickMap[fPickName] = holder;
}
const G4Colour& c = GetTextColour (text); // Picks up default if none.
MarkerSizeType sizeType;
G4double size = GetMarkerSize (text, sizeType);
@@ -200,6 +303,15 @@ void G4OpenGLSceneHandler::AddCircleSquare
(const G4VMarker& marker,
G4OpenGLBitMapStore::Shape shape) {
if (!fProcessingPolymarker) { // Polymarker has already loaded atts.
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(marker, holder);
fPickMap[fPickName] = holder;
}
}
// Note: colour treated in sub-class.
if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ())
@@ -260,7 +372,7 @@ void G4OpenGLSceneHandler::AddCircleSquare
const GLubyte* marker =
G4OpenGLBitMapStore::GetBitMap(shape, size, filled);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glBitmap(size, size, size/2., size/2., 0., 0., marker);
glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker);
}
}
@@ -298,6 +410,11 @@ void G4OpenGLSceneHandler::DrawXYPolygon
glEnd ();
}
void G4OpenGLSceneHandler::AddPrimitive (const G4Scale& scale)
{
G4VSceneHandler::AddPrimitive(scale);
}
//Method for handling G4Polyhedron objects for drawing solids.
void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
@@ -306,6 +423,13 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
if (polyhedron.GetNoFacets() == 0) return;
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(polyhedron, holder);
fPickMap[fPickName] = holder;
}
// Get vis attributes - pick up defaults if none.
const G4VisAttributes* pVA =
fpViewer -> GetApplicableVisAttributes (polyhedron.GetVisAttributes ());
@@ -589,6 +713,13 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
//Knots and Ctrl Pnts MUST be arrays of GLfloats.
void G4OpenGLSceneHandler::AddPrimitive (const G4NURBS& nurb) {
// Loads G4Atts for picking...
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
LoadAtts(nurb, holder);
fPickMap[fPickName] = holder;
}
GLUnurbsObj *gl_nurb;
gl_nurb = gluNewNurbsRenderer ();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.32 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.34 2007/04/04 16:50:27 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -45,17 +45,22 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4Text.hh"
#include "G4Circle.hh"
#include "G4Square.hh"
#include "G4Polyhedron.hh"
#include "G4AttHolder.hh"
G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler (G4VGraphicsSystem& system,
const G4String& name):
G4OpenGLSceneHandler (system, fSceneIdCount++, name),
fMemoryForDisplayLists (true),
fAddPrimitivePreambleNestingDepth (0),
fTopPODL (0)
fTopPODL (0),
fProcessing2D (false)
{}
G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ()
@@ -68,37 +73,91 @@ void G4OpenGLStoredSceneHandler::AddPrimitivePreamble(const G4Visible& visible)
fAddPrimitivePreambleNestingDepth++;
if (fAddPrimitivePreambleNestingDepth > 1) return;
// Because of our need to control colour of transients (display by
// time fading), display lists may only cover a single primitive.
// So display list setup is here.
if (fpViewer->GetViewParameters().IsPicking()) {
fPickMap[++fPickName] = 0;
}
const G4Colour& c = GetColour (visible);
if (fMemoryForDisplayLists && fReadyForTransients) {
TO& to = fTOList.back(); // Transient object information.
// Get vis attributes - pick up defaults if none.
const G4VisAttributes* pVA =
fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
// Get time information from vis attributes.
to.fStartTime = pVA->GetStartTime();
to.fEndTime = pVA->GetEndTime();
// Keep colour out of (already started) display list so that it
// can be applied independently.
glEndList();
glDeleteLists(fDisplayListId, 1);
to.fColour = c;
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
if (fMemoryForDisplayLists) {
fDisplayListId = glGenLists (1);
if (!fDisplayListId) { // Could pre-allocate?
G4cout <<
"********************* WARNING! ********************"
"\nUnable to allocate any more display lists in OpenGL."
"\n Continuing drawing in IMMEDIATE MODE."
"\n***************************************************"
<< G4endl;
fMemoryForDisplayLists = false;
}
}
if (fMemoryForDisplayLists) {
if (fReadyForTransients) {
TO to(fDisplayListId, *fpObjectTransformation);
to.fPickName = fPickName;
to.fColour = c;
const G4VisAttributes* pVA =
fpViewer->GetApplicableVisAttributes(visible.GetVisAttributes());
to.fStartTime = pVA->GetStartTime();
to.fEndTime = pVA->GetEndTime();
fTOList.push_back(to);
glDrawBuffer (GL_FRONT);
glPushMatrix();
G4OpenGLTransform3D oglt (*fpObjectTransformation);
glMultMatrixd (oglt.GetGLMatrix ());
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
}
else {
PO po(fDisplayListId, *fpObjectTransformation);
po.fPickName = fPickName;
fPOList.push_back(po);
glNewList (fDisplayListId, GL_COMPILE);
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
}
} else {
// Make sure colour is set in other cases.
glDrawBuffer (GL_FRONT);
glPushMatrix();
G4OpenGLTransform3D oglt (*fpObjectTransformation);
glMultMatrixd (oglt.GetGLMatrix ());
glColor3d (c.GetRed (), c.GetGreen (), c.GetBlue ());
}
if (fProcessing2D) {
// Push current 3D world matrices and load identity to define screen
// coordinates...
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
}
}
void G4OpenGLStoredSceneHandler::AddPrimitivePostamble()
{
if (fProcessing2D) {
// Pop current 3D world matrices back again...
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
}
if (fMemoryForDisplayLists) {
glEndList();
}
if (fReadyForTransients || !fMemoryForDisplayLists) {
glPopMatrix();
glFlush ();
glDrawBuffer (GL_BACK);
}
fAddPrimitivePreambleNestingDepth--;
}
@@ -109,6 +168,23 @@ void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyline& polyline)
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
{
AddPrimitivePreamble(polymarker);
G4OpenGLSceneHandler::AddPrimitive(polymarker);
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Text& text)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
// gets into the display list
AddPrimitivePreamble(text);
G4OpenGLSceneHandler::AddPrimitive(text);
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Circle& circle)
{
AddPrimitivePreamble(circle);
@@ -123,116 +199,55 @@ void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Square& square)
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Scale& scale)
{
AddPrimitivePreamble(polymarker);
G4OpenGLSceneHandler::AddPrimitive(polymarker);
// Let base class split into primitives.
G4OpenGLSceneHandler::AddPrimitive(scale);
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
// gets into the display list
AddPrimitivePreamble(polyhedron);
G4OpenGLSceneHandler::AddPrimitive(polyhedron);
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::AddPrimitive (const G4NURBS& nurbs)
{
// Note: colour is still handled in
// G4OpenGLSceneHandler::AddPrimitive(const G4NURBS&), so it still
// gets into the display list
AddPrimitivePreamble(nurbs);
G4OpenGLSceneHandler::AddPrimitive(nurbs);
AddPrimitivePostamble();
}
void G4OpenGLStoredSceneHandler::BeginPrimitives
(const G4Transform3D& objectTransformation) {
G4VSceneHandler::BeginPrimitives (objectTransformation);
(const G4Transform3D& objectTransformation)
{
G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
if (fMemoryForDisplayLists) {
fDisplayListId = glGenLists (1);
if (!fDisplayListId) { // Could pre-allocate?
G4cout << "********************* WARNING! ********************\n"
<<"Unable to allocate any more display lists in OpenGL.\n "
<< " Continuing drawing in IMMEDIATE MODE.\n"
<< "***************************************************" << G4endl;
fMemoryForDisplayLists = false;
}
}
if (fMemoryForDisplayLists) {
if (fReadyForTransients) {
TO to(fDisplayListId, objectTransformation);
fTOList.push_back(to);
glDrawBuffer (GL_FRONT);
glPushMatrix();
G4OpenGLTransform3D oglt (objectTransformation);
glMultMatrixd (oglt.GetGLMatrix ());
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
}
else {
fPOList.push_back(PO(fDisplayListId, objectTransformation));
glNewList (fDisplayListId, GL_COMPILE);
}
} else {
glDrawBuffer (GL_FRONT);
glPushMatrix();
G4OpenGLTransform3D oglt (objectTransformation);
glMultMatrixd (oglt.GetGLMatrix ());
}
// Display list setup moved to AddPrimitivePreamble. See notes there.
}
void G4OpenGLStoredSceneHandler::EndPrimitives () {
if (fMemoryForDisplayLists) {
glEndList();
}
if (fReadyForTransients || !fMemoryForDisplayLists) {
glPopMatrix();
glFlush ();
glDrawBuffer (GL_BACK);
}
G4VSceneHandler::EndPrimitives ();
void G4OpenGLStoredSceneHandler::EndPrimitives ()
{
G4OpenGLSceneHandler::EndPrimitives ();
}
void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
{
G4VSceneHandler::BeginPrimitives2D();
if (fMemoryForDisplayLists) {
fDisplayListId = glGenLists (1);
if (!fDisplayListId) { // Could pre-allocate?
G4cout << "********************* WARNING! ********************\n"
<<"Unable to allocate any more display lists in OpenGL.\n "
<< " Continuing drawing in IMMEDIATE MODE.\n"
<< "***************************************************" << G4endl;
fMemoryForDisplayLists = false;
}
}
if (fMemoryForDisplayLists) {
if (fReadyForTransients) {
fTOList.push_back(TO(fDisplayListId));
glDrawBuffer (GL_FRONT);
glNewList (fDisplayListId, GL_COMPILE_AND_EXECUTE);
}
else {
fPOList.push_back(PO(fDisplayListId));
glNewList (fDisplayListId, GL_COMPILE);
}
} else {
glDrawBuffer (GL_FRONT);
}
// Push current 3D world matrices and load identity to define screen
// coordinates...
glMatrixMode (GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
glMatrixMode (GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
G4OpenGLSceneHandler::BeginPrimitives2D();
fProcessing2D = true;
}
void G4OpenGLStoredSceneHandler::EndPrimitives2D ()
{
// Pop current 3D world matrices back again...
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
glPopMatrix();
if (fMemoryForDisplayLists) {
glEndList();
}
if (fReadyForTransients || !fMemoryForDisplayLists) {
glFlush ();
glDrawBuffer (GL_BACK);
}
G4VSceneHandler::EndPrimitives2D ();
fProcessing2D = false;
G4OpenGLSceneHandler::EndPrimitives2D ();
}
void G4OpenGLStoredSceneHandler::BeginModeling () {
@@ -252,13 +267,14 @@ void G4OpenGLStoredSceneHandler::EndModeling () {
"ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
" display List for fTopPODL - try OpenGL Immediated mode."
<< G4endl;
}
else {
} else {
glNewList (fTopPODL, GL_COMPILE_AND_EXECUTE); {
for (size_t i = 0; i < fPOList.size (); i++) {
glPushMatrix();
G4OpenGLTransform3D oglt (fPOList[i].fTransform);
glMultMatrixd (oglt.GetGLMatrix ());
if (fpViewer->GetViewParameters().IsPicking())
glLoadName(fPOList[i].fPickName);
glCallList (fPOList[i].fDisplayListId);
glPopMatrix();
}
@@ -287,6 +303,7 @@ void G4OpenGLStoredSceneHandler::ClearStore () {
// Clear other lists, dictionary, etc.
fPOList.clear ();
fSolidMap.clear ();
ClearAndDestroyAtts();
// ...and clear transient store...
for (size_t i = 0; i < fTOList.size (); i++)
@@ -374,7 +391,22 @@ void G4OpenGLStoredSceneHandler::RequestPrimitives (const G4VSolid& solid)
// ...and if the solid has already been rendered...
(fSolidMap.find (pSolid) != fSolidMap.end ())) {
fDisplayListId = fSolidMap [pSolid];
fPOList.push_back(PO(fDisplayListId,*fpObjectTransformation));
PO po(fDisplayListId,*fpObjectTransformation);
if (fpViewer->GetViewParameters().IsPicking()) {
G4AttHolder* holder = new G4AttHolder;
// Load G4Atts from G4VisAttributes, if any...
const G4VisAttributes* va = pPVModel->GetCurrentLV()->GetVisAttributes();
if (va) {
const std::map<G4String,G4AttDef>* vaDefs = va->GetAttDefs();
if (vaDefs) holder->AddAtts(va->CreateAttValues(), vaDefs);
}
// Load G4Atts from G4PhysicalVolumeModel...
const std::map<G4String,G4AttDef>* defs = pPVModel->GetAttDefs();
if (defs) holder->AddAtts(pPVModel->CreateCurrentAttValues(), defs);
fPickMap[++fPickName] = holder;
po.fPickName = fPickName;
}
fPOList.push_back(po);
}
else {
G4VSceneHandler::RequestPrimitives (solid);
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredViewer.cc,v 1.21 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLStoredViewer.cc,v 1.23 2007/04/04 16:50:27 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -87,11 +87,11 @@ G4bool G4OpenGLStoredViewer::CompareForKernelVisit(G4ViewParameters& lastVP) {
(lastVP.IsExplode () != fVP.IsExplode ()) ||
(lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
(lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())
) {
(lastVP.GetBackgroundColour ()!= fVP.GetBackgroundColour ())||
(lastVP.IsPicking () != fVP.IsPicking ())
)
return true;
}
if (lastVP.IsDensityCulling () &&
(lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
return true;
@@ -141,7 +141,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
glEnable (GL_CLIP_PLANE2);
}
if (fG4OpenGLStoredSceneHandler.fTopPODL)
if (fG4OpenGLStoredSceneHandler.fTopPODL)
glCallList (fG4OpenGLStoredSceneHandler.fTopPODL);
for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) {
@@ -151,6 +151,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
glPushMatrix();
G4OpenGLTransform3D oglt (to.fTransform);
glMultMatrixd (oglt.GetGLMatrix ());
if (fVP.IsPicking()) glLoadName(to.fPickName);
G4Colour& c = to.fColour;
G4double bsf = 1.; // Brightness scaling factor.
if (fFadeFactor > 0. && to.fEndTime < fEndTime)
@@ -182,7 +183,8 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
fDisplayHeadTimeGreen,
fDisplayHeadTimeBlue));
headTimeText.SetVisAttributes(&visAtts);
fG4OpenGLStoredSceneHandler.AddPrimitive(headTimeText);
static_cast<G4OpenGLSceneHandler&>(fSceneHandler).
G4OpenGLSceneHandler::AddPrimitive(headTimeText);
glMatrixMode (GL_PROJECTION);
glPopMatrix();
glMatrixMode (GL_MODELVIEW);
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredWin32.cc,v 1.14 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// OpenGLStoredWin32 graphics system factory.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.18 2006/09/04 12:07:59 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLStoredWin32Viewer.cc,v 1.19 2007/04/04 16:50:27 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
@@ -122,7 +122,9 @@ void G4OpenGLStoredWin32Viewer::FinishView (
if(!fHDC) return;
glFlush ();
::SwapBuffers(fHDC);
GLint renderMode;
glGetIntegerv(GL_RENDER_MODE, &renderMode);
if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
// Empty the Windows message queue :
MSG event;
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredX.cc,v 1.13 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredXViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLStoredXViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -125,7 +125,9 @@ void G4OpenGLStoredXViewer::DrawView () {
void G4OpenGLStoredXViewer::FinishView () {
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
//be propogated before progressing.
glXSwapBuffers (dpy, win);
GLint renderMode;
glGetIntegerv(GL_RENDER_MODE, &renderMode);
if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);
}
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLStoredXm.cc,v 1.11 2006/08/14 12:07:19 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLStoredXmViewer.cc,v 1.21 2006/09/04 12:07:59 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLStoredXmViewer.cc,v 1.22 2007/04/04 16:50:27 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -130,7 +130,9 @@ void G4OpenGLStoredXmViewer::DrawView () {
void G4OpenGLStoredXmViewer::FinishView () {
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
//be propogated before progressing.
glXSwapBuffers (dpy, win);
GLint renderMode;
glGetIntegerv(GL_RENDER_MODE, &renderMode);
if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);
}
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLTransform3D.cc,v 1.8 2006/06/29 21:19:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 24th October 1996
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewer.cc,v 1.30 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLViewer.cc,v 1.34 2007/05/24 18:27:13 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 27th March 1996
@@ -45,9 +45,46 @@
#include "G4Point3D.hh"
#include "G4Normal3D.hh"
#include "G4Plane3D.hh"
#include "G4AttHolder.hh"
#include "G4AttCheck.hh"
#include <sstream>
static const char* gouraudtriangleEPS[] =
{
"/bd{bind def}bind def /triangle { aload pop setrgbcolor aload pop 5 3",
"roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",
"/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",
"index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",
"} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",
"computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",
"computediff1 {true} { 3 copy 2 get 3 1 roll 2 get 3 1 roll 2 get",
"computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",
"aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",
"div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",
"-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",
"2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",
"roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",
"1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",
"2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",
"aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",
"astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",
"index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",
"gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",
"array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",
"15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",
"index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",
"roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",
"index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",
"add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",
NULL
};
G4OpenGLViewer::G4OpenGLViewer (G4OpenGLSceneHandler& scene):
G4VViewer (scene, -1),
pointSize (0),
print_colour (true),
vectored_ps (true),
fOpenGLSceneHandler(scene),
background (G4Colour(0.,0.,0.)),
transparency_enabled (true),
antialiasing_enabled (false),
@@ -81,6 +118,7 @@ fDisplayLightFrontBlue(0.)
// glDisable (GL_LINE_SMOOTH);
// glDisable (GL_POLYGON_SMOOTH);
strcpy (print_string, "G4OpenGL.eps");
}
G4OpenGLViewer::~G4OpenGLViewer () {}
@@ -272,4 +310,533 @@ void G4OpenGLViewer::HaloingSecondPass () {
}
void G4OpenGLViewer::Pick(GLdouble x, GLdouble y)
{
//G4cout << "X: " << x << ", Y: " << y << G4endl;
const G4int BUFSIZE = 512;
GLuint selectBuffer[BUFSIZE];
glSelectBuffer(BUFSIZE, selectBuffer);
glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
G4double currentProjectionMatrix[16];
glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
glPushMatrix();
glLoadIdentity();
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
// Define 5x5 pixel pick area
gluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
glMultMatrixd(currentProjectionMatrix);
glMatrixMode(GL_MODELVIEW);
DrawView();
GLint hits = glRenderMode(GL_RENDER);
if (hits < 0)
G4cout << "Too many hits. Zoom in to reduce overlaps." << G4cout;
else if (hits > 0) {
//G4cout << hits << " hit(s)" << G4endl;
GLuint* p = selectBuffer;
for (GLint i = 0; i < hits; ++i) {
GLuint nnames = *p++;
*p++; //OR GLuint zmin = *p++;
*p++; //OR GLuint zmax = *p++;
//G4cout << "Hit " << i << ": " << nnames << " names"
// << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
for (GLuint j = 0; j < nnames; ++j) {
GLuint name = *p++;
//G4cout << "Name " << j << ": PickName: " << name << G4endl;
std::map<GLuint, G4AttHolder*>::iterator iter =
fOpenGLSceneHandler.fPickMap.find(name);
if (iter != fOpenGLSceneHandler.fPickMap.end()) {
G4AttHolder* attHolder = iter->second;
if(attHolder && attHolder->GetAttDefs().size()) {
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
attHolder->GetAttDefs()[i]);
}
}
}
}
G4cout << G4endl;
}
}
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
}
void G4OpenGLViewer::print() {
// Print vectored PostScript
G4int size = 5000000;
GLfloat* feedback_buffer;
GLint returned;
FILE* file;
feedback_buffer = new GLfloat[size];
glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
glRenderMode (GL_FEEDBACK);
DrawView();
returned = glRenderMode (GL_RENDER);
if (print_string) {
file = fopen (print_string, "w");
if (file) {
spewWireframeEPS (file, returned, feedback_buffer, "rendereps");
} else {
printf("Could not open %s\n", print_string);
}
} else {
printBuffer (returned, feedback_buffer);
}
delete[] feedback_buffer;
}
void G4OpenGLViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer)
{
G4int i;
printf(" ");
for (i = 0; i < 7; i++) {
printf("%4.2f ", buffer[size - (*count)]);
*count = *count - 1;
}
printf("\n");
}
void G4OpenGLViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) {
GLfloat EPS_GOURAUD_THRESHOLD=0.1;
GLfloat clearColor[4], viewport[4];
GLfloat lineWidth;
G4int i;
glGetFloatv (GL_VIEWPORT, viewport);
glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor);
glGetFloatv (GL_LINE_WIDTH, &lineWidth);
glGetFloatv (GL_POINT_SIZE, &pointSize);
fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file);
fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr);
fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]);
fputs ("%%EndComments\n", file);
fputs ("\n", file);
fputs ("gsave\n", file);
fputs ("\n", file);
fputs ("% the gouraudtriangle PostScript fragment below is free\n", file);
fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file);
fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD);
for (i=0; gouraudtriangleEPS[i]; i++) {
fprintf (file, "%s\n", gouraudtriangleEPS[i]);
}
fprintf(file, "\n%g setlinewidth\n", lineWidth);
fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]);
fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]);
spewSortedFeedback (file, size, buffer);
fputs ("grestore\n\n", file);
fputs ("showpage\n", file);
fclose(file);
}
void G4OpenGLViewer::printBuffer (GLint size, GLfloat* buffer) {
GLint count;
G4int token, nvertices;
count=size;
while(count) {
token=G4int (buffer[size-count]);
count--;
switch (token) {
case GL_PASS_THROUGH_TOKEN:
printf ("GL_PASS_THROUGH_TOKEN\n");
printf (" %4.2f\n", buffer[size-count]);
count--;
break;
case GL_POINT_TOKEN:
printf ("GL_POINT_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
break;
case GL_LINE_TOKEN:
printf ("GL_LINE_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
print3DcolorVertex (size, &count, buffer);
break;
case GL_LINE_RESET_TOKEN:
printf ("GL_LINE_RESET_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
print3DcolorVertex (size, &count, buffer);
break;
case GL_POLYGON_TOKEN:
printf ("GL_POLYGON_TOKEN\n");
nvertices=G4int (buffer[size-count]);
count--;
for (; nvertices>0; nvertices--) {
print3DcolorVertex (size, &count, buffer);
}
}
}
}
G4float* G4OpenGLViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
G4int token;
G4int nvertices, i;
GLfloat red, green, blue, intensity;
G4int smooth;
GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax;
G4int steps;
Feedback3Dcolor *vertex;
GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.);
GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.);
token=G4int (*loc);
loc++;
switch (token) {
case GL_LINE_RESET_TOKEN:
case GL_LINE_TOKEN:
vertex=(Feedback3Dcolor*)loc;
dr=vertex[1].red - vertex[0].red;
dg=vertex[1].green - vertex[0].green;
db=vertex[1].blue - vertex[0].blue;
if (!print_colour) {
dr+=(dg+db);
dr/=3.0;
dg=dr;
db=dr;
}
if (dr!=0 || dg!=0 || db!=0) {
dx=vertex[1].x - vertex[0].x;
dy=vertex[1].y - vertex[0].y;
distance=std::sqrt(dx*dx + dy*dy);
absR=std::fabs(dr);
absG=std::fabs(dg);
absB=std::fabs(db);
#define Max(a, b) (((a)>(b))?(a):(b))
#define EPS_SMOOTH_LINE_FACTOR 0.06
colormax=Max(absR, Max(absG, absB));
steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR));
xstep=dx/steps;
ystep=dy/steps;
rstep=dr/steps;
gstep=dg/steps;
bstep=db/steps;
xnext=vertex[0].x;
ynext=vertex[0].y;
rnext=vertex[0].red;
gnext=vertex[0].green;
bnext=vertex[0].blue;
if (!print_colour) {
rnext+=(gnext+bnext);
rnext/=3.0;
gnext=rnext;
bnext=rnext;
}
xnext -= xstep/2.0;
ynext -= ystep/2.0;
rnext -= rstep/2.0;
gnext -= gstep/2.0;
bnext -= bstep/2.0;
} else {
steps=0;
}
if (print_colour) {
fprintf (file, "%g %g %g setrgbcolor\n",
vertex[0].red, vertex[0].green, vertex[0].blue);
} else {
intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0;
fprintf (file, "%g %g %g setrgbcolor\n",
intensity, intensity, intensity);
}
fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
for (i=0; i<steps; i++) {
xnext += xstep;
ynext += ystep;
rnext += rstep;
gnext += gstep;
bnext += bstep;
fprintf (file, "%g %g lineto stroke\n", xnext, ynext);
fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext);
fprintf (file, "%g %g moveto\n", xnext, ynext);
}
fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y);
loc += 14;
break;
case GL_POLYGON_TOKEN:
nvertices = G4int (*loc);
loc++;
vertex=(Feedback3Dcolor*)loc;
if (nvertices>0) {
red=vertex[0].red;
green=vertex[0].green;
blue=vertex[0].blue;
smooth=0;
if (!print_colour) {
red+=(green+blue);
red/=3.0;
green=red;
blue=red;
}
if (print_colour) {
for (i=1; i<nvertices; i++) {
if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) {
smooth=1;
break;
}
}
} else {
for (i=1; i<nvertices; i++) {
intensity = vertex[i].red + vertex[i].green + vertex[i].blue;
intensity/=3.0;
if (red!=intensity) {
smooth=1;
break;
}
}
}
if (smooth) {
G4int triOffset;
for (i=0; i<nvertices-2; i++) {
triOffset = i*7;
fprintf (file, "[%g %g %g %g %g %g]",
vertex[0].x, vertex[i+1].x, vertex[i+2].x,
vertex[0].y, vertex[i+1].y, vertex[i+2].y);
if (print_colour) {
fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n",
vertex[0].red, vertex[0].green, vertex[0].blue,
vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue,
vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue);
} else {
intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
intensity = vertex[1].red + vertex[1].green + vertex[1].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
intensity = vertex[2].red + vertex[2].green + vertex[2].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity);
}
}
} else {
fprintf (file, "newpath\n");
fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue);
fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
for (i=1; i<nvertices; i++) {
fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y);
}
fprintf (file, "closepath fill\n\n");
}
}
loc += nvertices*7;
break;
case GL_POINT_TOKEN:
vertex=(Feedback3Dcolor*)loc;
if (print_colour) {
fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue);
} else {
intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
intensity/=3.0;
fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity);
}
fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0);
loc += 7; /* Each vertex element in the feedback
buffer is 7 GLfloats. */
break;
default:
/* XXX Left as an excersie to the reader. */
static G4bool spewPrimitiveEPSWarned = false;
if (!spewPrimitiveEPSWarned) {
std::ostringstream oss;
oss <<
"Incomplete implementation. Unexpected token (" << token << ")."
"\n (Seems to be caused by text.)";
G4Exception("G4OpenGLViewer::spewPrimitiveEPS",
"Unexpected token",
JustWarning,
oss.str().c_str());
spewPrimitiveEPSWarned = true;
}
}
return loc;
}
typedef struct G4OpenGLViewerDepthIndex {
GLfloat *ptr;
GLfloat depth;
} DepthIndex;
extern "C" {
int G4OpenGLViewercompare(const void *a, const void *b)
{
const DepthIndex *p1 = (DepthIndex *) a;
const DepthIndex *p2 = (DepthIndex *) b;
GLfloat diff = p2->depth - p1->depth;
if (diff > 0.0) {
return 1;
} else if (diff < 0.0) {
return -1;
} else {
return 0;
}
}
}
void G4OpenGLViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
{
int token;
GLfloat *loc, *end;
Feedback3Dcolor *vertex;
GLfloat depthSum;
int nprimitives, item;
DepthIndex *prims;
int nvertices, i;
end = buffer + size;
/* Count how many primitives there are. */
nprimitives = 0;
loc = buffer;
while (loc < end) {
token = int (*loc);
loc++;
switch (token) {
case GL_LINE_TOKEN:
case GL_LINE_RESET_TOKEN:
loc += 14;
nprimitives++;
break;
case GL_POLYGON_TOKEN:
nvertices = int (*loc);
loc++;
loc += (7 * nvertices);
nprimitives++;
break;
case GL_POINT_TOKEN:
loc += 7;
nprimitives++;
break;
default:
/* XXX Left as an excersie to the reader. */
static G4bool spewSortedFeedbackWarned = false;
if (!spewSortedFeedbackWarned) {
std::ostringstream oss;
oss <<
"Incomplete implementation. Unexpected token (" << token << ")."
"\n (Seems to be caused by text.)";
G4Exception("G4OpenGLViewer::spewSortedFeedback",
"Unexpected token",
JustWarning,
oss.str().c_str());
spewSortedFeedbackWarned = true;
}
nprimitives++;
}
}
/* Allocate an array of pointers that will point back at
primitives in the feedback buffer. There will be one
entry per primitive. This array is also where we keep the
primitive's average depth. There is one entry per
primitive in the feedback buffer. */
prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives);
item = 0;
loc = buffer;
while (loc < end) {
prims[item].ptr = loc; /* Save this primitive's location. */
token = int (*loc);
loc++;
switch (token) {
case GL_LINE_TOKEN:
case GL_LINE_RESET_TOKEN:
vertex = (Feedback3Dcolor *) loc;
depthSum = vertex[0].z + vertex[1].z;
prims[item].depth = depthSum / 2.0;
loc += 14;
break;
case GL_POLYGON_TOKEN:
nvertices = int (*loc);
loc++;
vertex = (Feedback3Dcolor *) loc;
depthSum = vertex[0].z;
for (i = 1; i < nvertices; i++) {
depthSum += vertex[i].z;
}
prims[item].depth = depthSum / nvertices;
loc += (7 * nvertices);
break;
case GL_POINT_TOKEN:
vertex = (Feedback3Dcolor *) loc;
prims[item].depth = vertex[0].z;
loc += 7;
break;
default:
/* XXX Left as an excersie to the reader. */
assert(1);
}
item++;
}
assert(item == nprimitives);
/* Sort the primitives back to front. */
qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLViewercompare);
/* Understand that sorting by a primitives average depth
doesn't allow us to disambiguate some cases like self
intersecting polygons. Handling these cases would require
breaking up the primitives. That's too involved for this
example. Sorting by depth is good enough for lots of
applications. */
/* Emit the Encapsulated PostScript for the primitives in
back to front order. */
for (item = 0; item < nprimitives; item++) {
(void) spewPrimitiveEPS(file, prims[item].ptr);
}
free(prims);
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLViewerMessenger.cc,v 1.6 2007/02/08 14:01:55 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLViewerMessenger.cc,v 1.8 2007/05/16 15:59:58 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
#include "G4OpenGLViewerMessenger.hh"
@@ -34,8 +34,10 @@
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAString.hh"
#include "G4VisManager.hh"
#include <sstream>
@@ -56,6 +58,13 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpDirectory = new G4UIdirectory("/vis/ogl/");
fpDirectory->SetGuidance("G4OpenGLViewer commands.");
fpCommandPrintEPS =
new G4UIcmdWithoutParameter("/vis/ogl/printEPS", this);
fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
fpCommandPrintEPS->SetGuidance
("Generates files with names G4OpenGL_n.eps, where n is a sequence"
"\nnumber, starting at 0.");
fpDirectorySet = new G4UIdirectory ("/vis/ogl/set/");
fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
@@ -164,6 +173,13 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
fpCommandFade->SetRange("fadefactor>=0.&&fadefactor<=1.");
fpCommandFade->SetDefaultValue(0.);
fpCommandPrintMode = new G4UIcmdWithAString
("/vis/ogl/set/printMode",this);
fpCommandPrintMode->SetGuidance("Set print mode");
fpCommandPrintMode->SetParameterName("print_mode",omitable = true);
fpCommandPrintMode->SetCandidates("vectored pixmap");
fpCommandPrintMode->SetDefaultValue("vectored");
fpCommandStartTime =
new G4UIcommand("/vis/ogl/set/startTime", this);
fpCommandStartTime->SetGuidance("Set start and range of track time.");
@@ -191,6 +207,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
{
delete fpCommandPrintMode;
delete fpCommandTransparency;
delete fpCommandStartTime;
delete fpCommandFade;
@@ -198,6 +215,7 @@ G4OpenGLViewerMessenger::~G4OpenGLViewerMessenger ()
delete fpCommandDisplayLightFront;
delete fpCommandDisplayHeadTime;
delete fpDirectorySet;
delete fpCommandPrintEPS;
delete fpDirectory;
}
@@ -226,6 +244,24 @@ void G4OpenGLViewerMessenger::SetNewValue
return;
}
if (command == fpCommandPrintEPS)
{
// Keep copy of print_string to preserve Xm behaviour...
char* tmp_string = new char[50];
strcpy (tmp_string, pOGLViewer->print_string);
// Make new print string...
static G4int file_count = 0;
std::ostringstream oss;
oss << "G4OpenGL_" << file_count++ << ".eps";
strcpy (pOGLViewer->print_string, oss.str().c_str());
// Print eps file...
pOGLViewer->print();
// Restore print_string for Xm...
strcpy (pOGLViewer->print_string, tmp_string);
delete tmp_string;
return;
}
G4OpenGLStoredViewer* pViewer =
dynamic_cast<G4OpenGLStoredViewer*>(pVViewer);
@@ -302,6 +338,19 @@ void G4OpenGLViewerMessenger::SetNewValue
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
}
if (command == fpCommandPrintMode)
{
if (newValue == "vectored") pViewer->vectored_ps = true;
if (newValue == "pixmap") {
pViewer->vectored_ps = false;
if (pVisManager->GetVerbosity() >= G4VisManager::warnings) {
G4cout <<
"WARNING: Only implemented for X Windows at present."
<< G4endl;
}
}
}
if (command == fpCommandStartTime)
{
G4String start_time_string, start_time_unit,
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLWin32Viewer.cc,v 1.17 2006/06/29 21:19:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// G4OpenGLWin32Viewer : Class to provide WindowsNT specific
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewer.cc,v 1.36 2007/02/08 13:47:22 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
// $Id: G4OpenGLXViewer.cc,v 1.42 2007/05/25 10:47:17 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 7th February 1997
@@ -76,41 +76,11 @@ int G4OpenGLXViewer::dblBuf_RGBA[13] =
#define USE_DEFAULT_COLORMAP 1
#define USE_STANDARD_COLORMAP 0
static const char* gouraudtriangleEPS[] =
{
"/bd{bind def}bind def /triangle { aload pop setrgbcolor aload pop 5 3",
"roll 4 2 roll 3 2 roll exch moveto lineto lineto closepath fill } bd",
"/computediff1 { 2 copy sub abs threshold ge {pop pop pop true} { exch 2",
"index sub abs threshold ge { pop pop true} { sub abs threshold ge } ifelse",
"} ifelse } bd /computediff3 { 3 copy 0 get 3 1 roll 0 get 3 1 roll 0 get",
"computediff1 {true} { 3 copy 1 get 3 1 roll 1 get 3 1 roll 1 get",
"computediff1 {true} { 3 copy 2 get 3 1 roll 2 get 3 1 roll 2 get",
"computediff1 } ifelse } ifelse } bd /middlecolor { aload pop 4 -1 roll",
"aload pop 4 -1 roll add 2 div 5 1 roll 3 -1 roll add 2 div 3 1 roll add 2",
"div 3 1 roll exch 3 array astore } bd /gouraudtriangle { computediff3 { 4",
"-1 roll aload 7 1 roll 6 -1 roll pop 3 -1 roll pop add 2 div 3 1 roll add",
"2 div exch 3 -1 roll aload 7 1 roll exch pop 4 -1 roll pop add 2 div 3 1",
"roll add 2 div exch 3 -1 roll aload 7 1 roll pop 3 -1 roll pop add 2 div 3",
"1 roll add 2 div exch 7 3 roll 10 -3 roll dup 3 index middlecolor 4 1 roll",
"2 copy middlecolor 4 1 roll 3 copy pop middlecolor 4 1 roll 13 -1 roll",
"aload pop 17 index 6 index 15 index 19 index 6 index 17 index 6 array",
"astore 10 index 10 index 14 index gouraudtriangle 17 index 5 index 17",
"index 19 index 5 index 19 index 6 array astore 10 index 9 index 13 index",
"gouraudtriangle 13 index 16 index 5 index 15 index 18 index 5 index 6",
"array astore 12 index 12 index 9 index gouraudtriangle 17 index 16 index",
"15 index 19 index 18 index 17 index 6 array astore 10 index 12 index 14",
"index gouraudtriangle 18 {pop} repeat } { aload pop 5 3 roll aload pop 7 3",
"roll aload pop 9 3 roll 4 index 6 index 4 index add add 3 div 10 1 roll 7",
"index 5 index 3 index add add 3 div 10 1 roll 6 index 4 index 2 index add",
"add 3 div 10 1 roll 9 {pop} repeat 3 array astore triangle } ifelse } bd",
NULL
};
XVisualInfo* G4OpenGLXViewer::vi_single_buffer = 0;
XVisualInfo* G4OpenGLXViewer::vi_double_buffer = 0;
extern "C" {
Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
static Bool G4OpenGLXViewerWaitForNotify (Display*, XEvent* e, char* arg) {
return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
}
}
@@ -124,6 +94,21 @@ void G4OpenGLXViewer::ShowView () {
glXWaitGL (); //Wait for effects of all previous OpenGL commands to
//be propagated before progressing.
glFlush ();
if (fVP.IsPicking()) {
G4cout <<
"Window activated for picking (left-mouse), exit (middle-mouse)."
<< G4endl;
while (true) {
if (XPending(dpy)) {
XNextEvent(dpy, &event);
if (event.type == ButtonPress && event.xbutton.button == 1) {
Pick(event.xbutton.x, event.xbutton.y);
}
else if (event.type == ButtonPress && event.xbutton.button == 2) break;
}
}
}
}
void G4OpenGLXViewer::GetXConnection () {
@@ -307,7 +292,17 @@ void G4OpenGLXViewer::CreateMainWindow () {
XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
// connect the context to a window
glXMakeCurrent (dpy, win, cx);
Bool success = glXMakeCurrent (dpy, win, cx);
if (!success) {
fViewId = -1; // This flags an error.
G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context."
<< G4endl;
GLint error = GL_NO_ERROR;
while ((error = glGetError()) != GL_NO_ERROR) {
G4cout << "GL Error: " << gluErrorString(error) << G4endl;
}
return;
}
}
@@ -351,15 +346,11 @@ void G4OpenGLXViewer::CreateFontLists () {
G4OpenGLXViewer::G4OpenGLXViewer (G4OpenGLSceneHandler& scene):
G4VViewer (scene, -1),
G4OpenGLViewer (scene),
print_colour (true),
vectored_ps (true),
vi_immediate (0),
vi_stored (0),
vi (0),
cmap (0)
{
strcpy (print_string, "G4OpenGL.eps");
GetXConnection ();
if (fViewId < 0) return;
@@ -442,36 +433,19 @@ void G4OpenGLXViewer::print() {
//cout << "print_col_callback requested with file name: " << print_string << G4endl;
if (vectored_ps) {
G4int size = 5000000;
GLfloat* feedback_buffer;
GLint returned;
FILE* file;
feedback_buffer = new GLfloat[size];
glFeedbackBuffer (size, GL_3D_COLOR, feedback_buffer);
glRenderMode (GL_FEEDBACK);
DrawView();
returned = glRenderMode (GL_RENDER);
if (print_string) {
file = fopen (print_string, "w");
if (file) {
spewWireframeEPS (file, returned, feedback_buffer, "rendereps");
} else {
printf("Could not open %s\n", print_string);
}
} else {
printBuffer (returned, feedback_buffer);
}
// free (feedback_buffer);
delete[] feedback_buffer;
G4OpenGLViewer::print();
} else {
XVisualInfo* pvi;
GLXContext pcx = create_GL_print_context(pvi);
if (!pcx) {
G4cout << "Unable to create print context." << G4endl;
return;
}
GLXContext tmp_cx;
tmp_cx = cx;
cx=pcx;
@@ -496,6 +470,7 @@ void G4OpenGLXViewer::print() {
glViewport (0, 0, WinSize_x, WinSize_y);
ClearView ();
SetView ();
DrawView ();
generateEPS (print_string,
@@ -513,464 +488,53 @@ void G4OpenGLXViewer::print() {
}
void G4OpenGLXViewer::print3DcolorVertex(GLint size, GLint * count, GLfloat * buffer)
{
G4int i;
printf(" ");
for (i = 0; i < 7; i++) {
printf("%4.2f ", buffer[size - (*count)]);
*count = *count - 1;
}
printf("\n");
}
void G4OpenGLXViewer::spewWireframeEPS (FILE* file, GLint size, GLfloat* buffer, const char* cr) {
GLfloat EPS_GOURAUD_THRESHOLD=0.1;
GLfloat clearColor[4], viewport[4];
GLfloat lineWidth;
G4int i;
glGetFloatv (GL_VIEWPORT, viewport);
glGetFloatv (GL_COLOR_CLEAR_VALUE, clearColor);
glGetFloatv (GL_LINE_WIDTH, &lineWidth);
glGetFloatv (GL_POINT_SIZE, &pointSize);
fputs ("%!PS-Adobe-2.0 EPSF-2.0\n", file);
fprintf (file, "%%%%Creator: %s (using OpenGL feedback)\n", cr);
fprintf (file, "%%%%BoundingBox: %g %g %g %g\n", viewport[0], viewport[1], viewport[2], viewport[3]);
fputs ("%%EndComments\n", file);
fputs ("\n", file);
fputs ("gsave\n", file);
fputs ("\n", file);
fputs ("% the gouraudtriangle PostScript fragment below is free\n", file);
fputs ("% written by Frederic Delhoume (delhoume@ilog.fr)\n", file);
fprintf (file, "/threshold %g def\n", EPS_GOURAUD_THRESHOLD);
for (i=0; gouraudtriangleEPS[i]; i++) {
fprintf (file, "%s\n", gouraudtriangleEPS[i]);
}
fprintf(file, "\n%g setlinewidth\n", lineWidth);
GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
fprintf (file, "%g %g %g setrgbcolor\n", clearColor[0], clearColor[1], clearColor[2]);
fprintf (file, "%g %g %g %g rectfill\n\n", viewport[0], viewport[1], viewport[2], viewport[3]);
GLubyte* buffer;
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
GLenum format;
int size;
spewSortedFeedback (file, size, buffer);
fputs ("grestore\n\n", file);
fputs ("showpage\n", file);
fclose(file);
}
void G4OpenGLXViewer::printBuffer (GLint size, GLfloat* buffer) {
GLint count;
G4int token, nvertices;
count=size;
while(count) {
token=G4int (buffer[size-count]);
count--;
switch (token) {
case GL_PASS_THROUGH_TOKEN:
printf ("GL_PASS_THROUGH_TOKEN\n");
printf (" %4.2f\n", buffer[size-count]);
count--;
break;
case GL_POINT_TOKEN:
printf ("GL_POINT_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
break;
case GL_LINE_TOKEN:
printf ("GL_LINE_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
print3DcolorVertex (size, &count, buffer);
break;
case GL_LINE_RESET_TOKEN:
printf ("GL_LINE_RESET_TOKEN\n");
print3DcolorVertex (size, &count, buffer);
print3DcolorVertex (size, &count, buffer);
break;
case GL_POLYGON_TOKEN:
printf ("GL_POLYGON_TOKEN\n");
nvertices=G4int (buffer[size-count]);
count--;
for (; nvertices>0; nvertices--) {
print3DcolorVertex (size, &count, buffer);
}
}
if (inColor) {
format = GL_RGB;
size = width*height*3;
} else {
format = GL_LUMINANCE;
size = width*height*1;
}
}
G4float* G4OpenGLXViewer::spewPrimitiveEPS (FILE* file, GLfloat* loc) {
buffer = new GLubyte[size];
if (buffer == NULL)
return NULL;
glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
G4int token;
G4int nvertices, i;
GLfloat red, green, blue, intensity;
G4int smooth;
GLfloat dx, dy, dr, dg, db, absR, absG, absB, colormax;
G4int steps;
Feedback3Dcolor *vertex;
GLfloat xstep(0.), ystep(0.), rstep(0.), gstep(0.), bstep(0.);
GLfloat xnext(0.), ynext(0.), rnext(0.), gnext(0.), bnext(0.), distance(0.);
token=G4int (*loc);
loc++;
switch (token) {
case GL_LINE_RESET_TOKEN:
case GL_LINE_TOKEN:
vertex=(Feedback3Dcolor*)loc;
dr=vertex[1].red - vertex[0].red;
dg=vertex[1].green - vertex[0].green;
db=vertex[1].blue - vertex[0].blue;
if (!print_colour) {
dr+=(dg+db);
dr/=3.0;
dg=dr;
db=dr;
}
if (dr!=0 || dg!=0 || db!=0) {
dx=vertex[1].x - vertex[0].x;
dy=vertex[1].y - vertex[0].y;
distance=std::sqrt(dx*dx + dy*dy);
absR=std::fabs(dr);
absG=std::fabs(dg);
absB=std::fabs(db);
#define Max(a, b) (((a)>(b))?(a):(b))
#define EPS_SMOOTH_LINE_FACTOR 0.06
colormax=Max(absR, Max(absG, absB));
steps=Max(1, G4int (colormax*distance*EPS_SMOOTH_LINE_FACTOR));
xstep=dx/steps;
ystep=dy/steps;
rstep=dr/steps;
gstep=dg/steps;
bstep=db/steps;
xnext=vertex[0].x;
ynext=vertex[0].y;
rnext=vertex[0].red;
gnext=vertex[0].green;
bnext=vertex[0].blue;
if (!print_colour) {
rnext+=(gnext+bnext);
rnext/=3.0;
gnext=rnext;
bnext=rnext;
}
xnext -= xstep/2.0;
ynext -= ystep/2.0;
rnext -= rstep/2.0;
gnext -= gstep/2.0;
bnext -= bstep/2.0;
} else {
steps=0;
}
if (print_colour) {
fprintf (file, "%g %g %g setrgbcolor\n",
vertex[0].red, vertex[0].green, vertex[0].blue);
} else {
intensity = (vertex[0].red + vertex[0].green + vertex[0].blue) / 3.0;
fprintf (file, "%g %g %g setrgbcolor\n",
intensity, intensity, intensity);
}
fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
for (i=0; i<steps; i++) {
xnext += xstep;
ynext += ystep;
rnext += rstep;
gnext += gstep;
bnext += bstep;
fprintf (file, "%g %g lineto stroke\n", xnext, ynext);
fprintf (file, "%g %g %g setrgbcolor\n", rnext, gnext, bnext);
fprintf (file, "%g %g moveto\n", xnext, ynext);
}
fprintf (file, "%g %g lineto stroke\n", vertex[1].x, vertex[1].y);
loc += 14;
break;
case GL_POLYGON_TOKEN:
nvertices = G4int (*loc);
loc++;
vertex=(Feedback3Dcolor*)loc;
if (nvertices>0) {
red=vertex[0].red;
green=vertex[0].green;
blue=vertex[0].blue;
smooth=0;
if (!print_colour) {
red+=(green+blue);
red/=3.0;
green=red;
blue=red;
}
if (print_colour) {
for (i=1; i<nvertices; i++) {
if (red!=vertex[i].red || green!=vertex[i].green || blue!=vertex[i].blue) {
smooth=1;
break;
}
}
} else {
for (i=1; i<nvertices; i++) {
intensity = vertex[i].red + vertex[i].green + vertex[i].blue;
intensity/=3.0;
if (red!=intensity) {
smooth=1;
break;
}
}
}
if (smooth) {
G4int triOffset;
for (i=0; i<nvertices-2; i++) {
triOffset = i*7;
fprintf (file, "[%g %g %g %g %g %g]",
vertex[0].x, vertex[i+1].x, vertex[i+2].x,
vertex[0].y, vertex[i+1].y, vertex[i+2].y);
if (print_colour) {
fprintf (file, " [%g %g %g] [%g %g %g] [%g %g %g] gouraudtriangle\n",
vertex[0].red, vertex[0].green, vertex[0].blue,
vertex[i+1].red, vertex[i+1].green, vertex[i+1].blue,
vertex[i+2].red, vertex[i+2].green, vertex[i+2].blue);
} else {
intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
intensity = vertex[1].red + vertex[1].green + vertex[1].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g]", intensity, intensity, intensity);
intensity = vertex[2].red + vertex[2].green + vertex[2].blue;
intensity/=3.0;
fprintf (file, " [%g %g %g] gouraudtriangle\n", intensity, intensity, intensity);
}
}
} else {
fprintf (file, "newpath\n");
fprintf (file, "%g %g %g setrgbcolor\n", red, green, blue);
fprintf (file, "%g %g moveto\n", vertex[0].x, vertex[0].y);
for (i=1; i<nvertices; i++) {
fprintf (file, "%g %g lineto\n", vertex[i].x, vertex[i].y);
}
fprintf (file, "closepath fill\n\n");
}
}
loc += nvertices*7;
break;
case GL_POINT_TOKEN:
vertex=(Feedback3Dcolor*)loc;
if (print_colour) {
fprintf (file, "%g %g %g setrgbcolor\n", vertex[0].red, vertex[0].green, vertex[0].blue);
} else {
intensity = vertex[0].red + vertex[0].green + vertex[0].blue;
intensity/=3.0;
fprintf (file, "%g %g %g setrgbcolor\n", intensity, intensity, intensity);
}
fprintf(file, "%g %g %g 0 360 arc fill\n\n", vertex[0].x, vertex[0].y, pointSize / 2.0);
loc += 7; /* Each vertex element in the feedback
buffer is 7 GLfloats. */
break;
default:
/* XXX Left as an excersie to the reader. */
static G4bool spewPrimitiveEPSWarned = false;
if (!spewPrimitiveEPSWarned) {
std::ostringstream oss;
oss <<
"Incomplete implementation. Unexpected token (" << token << ")."
"\n (Seems to be caused by text.)";
G4Exception("G4OpenGLXViewer::spewPrimitiveEPS",
"Unexpected token",
JustWarning,
oss.str().c_str());
spewPrimitiveEPSWarned = true;
}
}
return loc;
}
typedef struct G4OpenGLXViewerDepthIndex {
GLfloat *ptr;
GLfloat depth;
} DepthIndex;
extern "C" {
int G4OpenGLXViewercompare(const void *a, const void *b)
{
const DepthIndex *p1 = (DepthIndex *) a;
const DepthIndex *p2 = (DepthIndex *) b;
GLfloat diff = p2->depth - p1->depth;
if (diff > 0.0) {
return 1;
} else if (diff < 0.0) {
return -1;
} else {
return 0;
}
}
}
void G4OpenGLXViewer::spewSortedFeedback(FILE * file, GLint size, GLfloat * buffer)
{
int token;
GLfloat *loc, *end;
Feedback3Dcolor *vertex;
GLfloat depthSum;
int nprimitives, item;
DepthIndex *prims;
int nvertices, i;
end = buffer + size;
/* Count how many primitives there are. */
nprimitives = 0;
loc = buffer;
while (loc < end) {
token = int (*loc);
loc++;
switch (token) {
case GL_LINE_TOKEN:
case GL_LINE_RESET_TOKEN:
loc += 14;
nprimitives++;
break;
case GL_POLYGON_TOKEN:
nvertices = int (*loc);
loc++;
loc += (7 * nvertices);
nprimitives++;
break;
case GL_POINT_TOKEN:
loc += 7;
nprimitives++;
break;
default:
/* XXX Left as an excersie to the reader. */
static G4bool spewSortedFeedbackWarned = false;
if (!spewSortedFeedbackWarned) {
std::ostringstream oss;
oss <<
"Incomplete implementation. Unexpected token (" << token << ")."
"\n (Seems to be caused by text.)";
G4Exception("G4OpenGLXViewer::spewSortedFeedback",
"Unexpected token",
JustWarning,
oss.str().c_str());
spewSortedFeedbackWarned = true;
}
nprimitives++;
}
}
/* Allocate an array of pointers that will point back at
primitives in the feedback buffer. There will be one
entry per primitive. This array is also where we keep the
primitive's average depth. There is one entry per
primitive in the feedback buffer. */
prims = (DepthIndex *) malloc(sizeof(DepthIndex) * nprimitives);
item = 0;
loc = buffer;
while (loc < end) {
prims[item].ptr = loc; /* Save this primitive's location. */
token = int (*loc);
loc++;
switch (token) {
case GL_LINE_TOKEN:
case GL_LINE_RESET_TOKEN:
vertex = (Feedback3Dcolor *) loc;
depthSum = vertex[0].z + vertex[1].z;
prims[item].depth = depthSum / 2.0;
loc += 14;
break;
case GL_POLYGON_TOKEN:
nvertices = int (*loc);
loc++;
vertex = (Feedback3Dcolor *) loc;
depthSum = vertex[0].z;
for (i = 1; i < nvertices; i++) {
depthSum += vertex[i].z;
}
prims[item].depth = depthSum / nvertices;
loc += (7 * nvertices);
break;
case GL_POINT_TOKEN:
vertex = (Feedback3Dcolor *) loc;
prims[item].depth = vertex[0].z;
loc += 7;
break;
default:
/* XXX Left as an excersie to the reader. */
assert(1);
}
item++;
}
assert(item == nprimitives);
/* Sort the primitives back to front. */
qsort(prims, nprimitives, sizeof(DepthIndex), G4OpenGLXViewercompare);
/* Understand that sorting by a primitives average depth
doesn't allow us to disambiguate some cases like self
intersecting polygons. Handling these cases would require
breaking up the primitives. That's too involved for this
example. Sorting by depth is good enough for lots of
applications. */
/* Emit the Encapsulated PostScript for the primitives in
back to front order. */
for (item = 0; item < nprimitives; item++) {
(void) spewPrimitiveEPS(file, prims[item].ptr);
}
free(prims);
}
GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
pvi = glXChooseVisual (dpy,
XDefaultScreen (dpy),
snglBuf_RGBA);
if (!pvi) {
pvi = glXChooseVisual (dpy,
XDefaultScreen (dpy),
dblBuf_RGBA);
}
return glXCreateContext (dpy,
pvi,
NULL,
False);
return buffer;
}
int G4OpenGLXViewer::generateEPS (char* filnam,
@@ -1050,53 +614,22 @@ int G4OpenGLXViewer::generateEPS (char* filnam,
return 0;
}
GLubyte* G4OpenGLXViewer::grabPixels (int inColor, unsigned int width, unsigned int height) {
GLXContext G4OpenGLXViewer::create_GL_print_context(XVisualInfo*& pvi) {
GLubyte* buffer;
GLint swapbytes, lsbfirst, rowlength;
GLint skiprows, skippixels, alignment;
GLenum format;
int size;
pvi = glXChooseVisual (dpy,
XDefaultScreen (dpy),
snglBuf_RGBA);
if (inColor) {
format = GL_RGB;
size = width*height*3;
} else {
format = GL_LUMINANCE;
size = width*height*1;
if (!pvi) {
pvi = glXChooseVisual (dpy,
XDefaultScreen (dpy),
dblBuf_RGBA);
}
buffer = new GLubyte[size];
if (buffer == NULL)
return NULL;
glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
return buffer;
return glXCreateContext (dpy,
pvi,
NULL,
False);
}
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4OpenGLXViewerMessenger.cc,v 1.5 2006/11/21 16:24:00 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4OpenGLXViewerMessenger.cc,v 1.7 2007/05/25 15:41:38 allison Exp $
// GEANT4 tag $Name: geant4-09-00 $
#ifdef G4VIS_BUILD_OPENGLX_DRIVER
@@ -36,8 +36,6 @@
#include "G4UImanager.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithoutParameter.hh"
#include "G4UIcmdWithABool.hh"
#include "G4VisManager.hh"
#include <sstream>
@@ -54,22 +52,18 @@ G4OpenGLXViewerMessenger::G4OpenGLXViewerMessenger()
fpDirectory = new G4UIdirectory("/vis/oglx/");
fpDirectory->SetGuidance("G4OpenGLXViewer commands.");
fpCommandPrintEPS =
new G4UIcmdWithoutParameter("/vis/oglx/printEPS", this);
fpCommandPrintEPS->SetGuidance("Print Encapsulated PostScript file.");
fpCommandPrintEPS->SetGuidance
("Generates files with names G4OpenGL_n.eps, where n is a sequence"
"\nnumber, starting at 0.");
fpDirectorySet = new G4UIdirectory ("/vis/oglx/set/");
fpDirectorySet->SetGuidance("G4OpenGLViewer set commands.");
}
G4OpenGLXViewerMessenger::~G4OpenGLXViewerMessenger ()
{
delete fpCommandPrintEPS;
delete fpDirectory;
}
void G4OpenGLXViewerMessenger::SetNewValue
(G4UIcommand* command, G4String)
(G4UIcommand* /*command*/, G4String /*newValue*/)
{
G4VisManager* pVisManager = G4VisManager::GetInstance();
@@ -93,23 +87,6 @@ void G4OpenGLXViewerMessenger::SetNewValue
return;
}
if (command == fpCommandPrintEPS)
{
// Keep copy of print_string to preserve Xm behaviour...
char* tmp_string = new char[50];
strcpy (tmp_string, pViewer->print_string);
// Make new print string...
static G4int file_count = 0;
std::ostringstream oss;
oss << "G4OpenGL_" << file_count++ << ".eps";
strcpy (pViewer->print_string, oss.str().c_str());
// Print eps file...
pViewer->print();
// Restore print_string for Xm...
strcpy (pViewer->print_string, tmp_string);
delete tmp_string;
}
}
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmBox.cc,v 1.6 2006/06/29 21:19:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Box container class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmConvenienceRoutines.cc,v 1.11 2006/06/29 21:19:42 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th April 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmFourArrowButtons.cc,v 1.5 2006/06/29 21:19:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Four arrow buttons class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmFramedBox.cc,v 1.6 2006/06/29 21:19:46 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Framed box container class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmMainMenubarCallbacks.cc,v 1.13 2006/06/29 21:19:48 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th April 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmPanningCallbacks.cc,v 1.8 2006/06/29 21:19:50 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th April 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmPushButton.cc,v 1.6 2006/06/29 21:19:52 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Push button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmRadioButton.cc,v 1.6 2006/06/29 21:19:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Radio button class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmRotationCallbacks.cc,v 1.14 2006/06/29 21:19:56 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th April 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmSeparator.cc,v 1.5 2006/06/29 21:19:58 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Separator class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmSliderBar.cc,v 1.7 2006/06/29 21:20:00 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmStyleCallbacks.cc,v 1.14 2006/06/29 21:20:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th April 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmTextField.cc,v 1.7 2006/06/29 21:20:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Text field class. Inherits from G4OpenGLXmVWidgetComponent
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmTopLevelShell.cc,v 1.5 2006/06/29 21:20:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Top level shell class
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetComponent.cc,v 1.5 2006/06/29 21:20:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Base class for all Motif component widgets
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetContainer.cc,v 1.5 2006/06/29 21:20:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Base class for all Motif container widgets
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetObject.cc,v 1.5 2006/06/29 21:20:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Virtual base class for all Motif widgets.
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmVWidgetShell.cc,v 1.5 2006/06/29 21:20:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//Base class for all Motif shell widgets
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmViewer.cc,v 1.23 2006/06/29 21:20:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 10th February 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmViewerMessenger.cc,v 1.4 2006/06/29 21:20:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
@@ -25,7 +25,7 @@
//
//
// $Id: G4OpenGLXmWindowHandlingCallbacks.cc,v 1.6 2006/06/29 21:20:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// GEANT4 tag $Name: geant4-09-00 $
//
//
// Andrew Walkden 16th June 1997