Import Geant4 8.3.0 source tree
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLBitMapStore.cc,v 1.2 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// John Allison 6th January 2007
|
||||
|
||||
#include "G4OpenGLBitMapStore.hh"
|
||||
|
||||
namespace G4OpenGLBitMapStore {
|
||||
|
||||
std::map<Key, GLubyte*> fStore;
|
||||
|
||||
void SetBit(G4int i, G4int j, GLubyte* bitmap, G4int byteColumns)
|
||||
{
|
||||
G4int k = i / 8 + byteColumns * j;
|
||||
bitmap[k] |= 0x80 >> i % 8;
|
||||
}
|
||||
|
||||
const GLubyte* GetBitMap(Shape shape, G4double& size, G4bool filled)
|
||||
{
|
||||
// Rationalise size
|
||||
G4int bitSize = std::abs(size) + 0.49;
|
||||
if (bitSize < 1) bitSize = 1;
|
||||
|
||||
// Modify size in calling function (passed by reference).
|
||||
size = bitSize;
|
||||
|
||||
Key key(shape, bitSize, filled);
|
||||
|
||||
// If previously encountered, return.
|
||||
if (fStore.find(key) != fStore.end()) return fStore[key];
|
||||
|
||||
// Create and store new bitmap.
|
||||
G4int byteColumns = (G4int(bitSize - 1) / 8) + 1;
|
||||
G4int byteRows = bitSize;
|
||||
G4int nBytes = byteColumns*byteRows;
|
||||
GLubyte* bitmap = new GLubyte[nBytes];
|
||||
fStore[key] = bitmap;
|
||||
|
||||
if (shape == square && filled) { // Set all bits and return.
|
||||
for (G4int i = 0; i < nBytes; ++i) bitmap[i] = 0xff;
|
||||
return bitmap;
|
||||
} else { // Clear ready for setting bits.
|
||||
for (G4int i = 0; i < nBytes; ++i) bitmap[i] = 0x00;
|
||||
}
|
||||
|
||||
// Fill bitmap.
|
||||
GLint linewidth;
|
||||
glGetIntegerv(GL_LINE_WIDTH, &linewidth);
|
||||
if (linewidth > bitSize) linewidth = bitSize;
|
||||
G4double outer = bitSize / 2.;
|
||||
G4double outer2 = outer * outer;
|
||||
G4double inner = bitSize / 2. - linewidth;
|
||||
G4double inner2 = inner * inner;
|
||||
for (G4int i = 0; i < bitSize; ++i) {
|
||||
for (G4int j = 0; j < bitSize; ++j) {
|
||||
G4double x = i - (bitSize - 1) * 0.5;
|
||||
G4double y = j - (bitSize - 1) * 0.5;
|
||||
G4double r2 = x * x + y * y;
|
||||
if (shape == circle) {
|
||||
if (filled) {
|
||||
if (r2 < outer2) SetBit(i, j, bitmap, byteColumns);
|
||||
} else {
|
||||
if (r2 < outer2 && r2 > inner2) SetBit(i, j, bitmap, byteColumns);
|
||||
}
|
||||
} else { // Unfilled square.
|
||||
if (x < -inner || x > inner || y < -inner || y > inner)
|
||||
SetBit(i, j, bitmap, byteColumns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
} // End namespace G4OpenGLBitMapStore.
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.24 2006/09/04 12:03:25 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLImmediateSceneHandler.cc,v 1.25 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -121,7 +121,7 @@ void G4OpenGLImmediateSceneHandler::BeginPrimitives2D()
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.45 2006/08/30 11:37:34 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLSceneHandler.cc,v 1.48 2007/03/27 15:15:12 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -127,7 +127,11 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
G4double lineWidth = GetLineWidth(line);
|
||||
// Get vis attributes - pick up defaults if none.
|
||||
const G4VisAttributes* pVA =
|
||||
fpViewer -> GetApplicableVisAttributes (line.GetVisAttributes ());
|
||||
|
||||
G4double lineWidth = GetLineWidth(pVA);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
glBegin (GL_LINE_STRIP);
|
||||
@@ -174,7 +178,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
|
||||
glDisable (GL_DEPTH_TEST);
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
glRasterPos3f(position.x(),position.y(),position.z());
|
||||
glRasterPos3d(position.x(),position.y(),position.z());
|
||||
// No action on offset or layout at present.
|
||||
glPushAttrib(GL_LIST_BIT);
|
||||
glListBase(font_base);
|
||||
@@ -184,17 +188,17 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Text& text) {
|
||||
|
||||
void G4OpenGLSceneHandler::AddPrimitive (const G4Circle& circle) {
|
||||
glEnable (GL_POINT_SMOOTH);
|
||||
AddCircleSquare (circle, 24);
|
||||
AddCircleSquare (circle, G4OpenGLBitMapStore::circle);
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::AddPrimitive (const G4Square& square) {
|
||||
glDisable (GL_POINT_SMOOTH);
|
||||
AddCircleSquare (square, 4);
|
||||
AddCircleSquare (square, G4OpenGLBitMapStore::square);
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::AddCircleSquare
|
||||
(const G4VMarker& marker,
|
||||
G4int nSides) {
|
||||
G4OpenGLBitMapStore::Shape shape) {
|
||||
|
||||
// Note: colour treated in sub-class.
|
||||
|
||||
@@ -204,174 +208,78 @@ void G4OpenGLSceneHandler::AddCircleSquare
|
||||
|
||||
glDisable (GL_LIGHTING);
|
||||
|
||||
G4double lineWidth = GetLineWidth(marker);
|
||||
// Get vis attributes - pick up defaults if none.
|
||||
const G4VisAttributes* pVA =
|
||||
fpViewer -> GetApplicableVisAttributes (marker.GetVisAttributes ());
|
||||
|
||||
G4double lineWidth = GetLineWidth(pVA);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
G4VMarker::FillStyle style = marker.GetFillStyle();
|
||||
|
||||
G4bool filled = false;
|
||||
static G4bool hashedWarned = false;
|
||||
|
||||
switch (style) {
|
||||
case G4VMarker::noFill:
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_LINE);
|
||||
filled = false;
|
||||
break;
|
||||
|
||||
case G4VMarker::hashed:
|
||||
/*
|
||||
G4cout << "Hashed fill style in G4OpenGLSceneHandler."
|
||||
<< "\n Not implemented. Using G4VMarker::filled."
|
||||
<< G4endl;
|
||||
*/
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
glPolygonStipple (fStippleMaskHashed);
|
||||
// See also:
|
||||
// if (style == G4VMarker::filled || style == G4VMarker::hashed)...
|
||||
// (twice) below.
|
||||
break;
|
||||
if (!hashedWarned) {
|
||||
G4cout << "Hashed fill style in G4OpenGLSceneHandler."
|
||||
<< "\n Not implemented. Using G4VMarker::filled."
|
||||
<< G4endl;
|
||||
hashedWarned = true;
|
||||
}
|
||||
// Maybe use
|
||||
//glPolygonStipple (fStippleMaskHashed);
|
||||
// Drop through to filled...
|
||||
|
||||
case G4VMarker::filled:
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
break;
|
||||
|
||||
default:
|
||||
G4cout << "Unrecognised fill style in G4OpenGLSceneHandler."
|
||||
<< "\n Using G4VMarker::filled."
|
||||
<< G4endl;
|
||||
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
|
||||
filled = true;
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// A few useful quantities...
|
||||
G4Point3D centre = marker.GetPosition();
|
||||
const G4Vector3D& viewpointDirection =
|
||||
fpViewer -> GetViewParameters().GetViewpointDirection();
|
||||
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
|
||||
MarkerSizeType sizeType;
|
||||
G4double size = GetMarkerSize(marker, sizeType);
|
||||
|
||||
// Find "size" of marker in world space (but see note below)...
|
||||
G4double worldSize;
|
||||
if (sizeType == world) { // Size specified in world coordinates.
|
||||
worldSize = size;
|
||||
}
|
||||
else { // Size specified in screen (window) coordinates.
|
||||
|
||||
// Find window coordinates of centre...
|
||||
GLdouble modelMatrix[16];
|
||||
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
|
||||
G4double projectionMatrix[16];
|
||||
glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
|
||||
GLint viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT,viewport);
|
||||
GLdouble winx, winy, winz;
|
||||
gluProject(centre.x(), centre.y(), centre.z(),
|
||||
modelMatrix, projectionMatrix, viewport,
|
||||
&winx, &winy, &winz);
|
||||
|
||||
// Determine ratio window:world...
|
||||
const G4Vector3D inScreen = (up.cross(viewpointDirection)).unit();
|
||||
const G4Vector3D p = centre + inScreen;
|
||||
GLdouble winDx, winDy, winDz;
|
||||
gluProject(p.x(), p.y(), p.z(),
|
||||
modelMatrix, projectionMatrix, viewport,
|
||||
&winDx, &winDy, &winDz);
|
||||
G4double winWorldRatio = std::sqrt(std::pow(winx - winDx, 2) +
|
||||
std::pow(winy - winDy, 2));
|
||||
worldSize = size / winWorldRatio;
|
||||
}
|
||||
|
||||
// Draw...
|
||||
DrawXYPolygon (worldSize, centre, nSides);
|
||||
}
|
||||
if (sizeType == world) { // Size specified in world coordinates.
|
||||
|
||||
/***************************************************
|
||||
Note: We have to do it this way round so that when a global
|
||||
transformation is applied, such as with /vis/viewer/set/viewpoint,
|
||||
the markers follow the world coordinates without having to
|
||||
recreate the display lists. The down side is that the markers
|
||||
rotate. The only way to avoid this is to play with the modelview
|
||||
and projection matrices of OpenGL - which I need to think about.
|
||||
For future reference, here is the code to draw in window
|
||||
coordinates; its down side is that markers do not follow global
|
||||
transformations. Some clever stuff is needed.
|
||||
DrawXYPolygon (shape, size, centre, pVA);
|
||||
|
||||
...
|
||||
// Find window coordinates of centre...
|
||||
GLdouble modelMatrix[16];
|
||||
glGetDoublev (GL_MODELVIEW_MATRIX, modelMatrix);
|
||||
G4double projectionMatrix[16];
|
||||
glGetDoublev (GL_PROJECTION_MATRIX, projectionMatrix);
|
||||
GLint viewport[4];
|
||||
glGetIntegerv(GL_VIEWPORT,viewport);
|
||||
GLdouble winx, winy, winz;
|
||||
gluProject(centre.x(), centre.y(), centre.z(),
|
||||
modelMatrix, projectionMatrix, viewport,
|
||||
&winx, &winy, &winz);
|
||||
} else { // Size specified in screen (window) coordinates.
|
||||
|
||||
// Find window size...
|
||||
G4double winSize;
|
||||
if (size) { // Size specified in world coordinates.
|
||||
// Determine size in window coordinates...
|
||||
(Note: improve this by using an inScreen vector as above.)
|
||||
GLdouble winx1, winy1, winz1;
|
||||
gluProject(centre.x() + size, centre.y() + size, centre.z() + size,
|
||||
modelMatrix, projectionMatrix, viewport,
|
||||
&winx1, &winy1, &winz1);
|
||||
winSize = std::sqrt((std::pow(winx - winx1, 2) +
|
||||
std::pow(winy - winy1, 2) +
|
||||
std::pow(winz - winz1, 2)) / 3.);
|
||||
glRasterPos3d(centre.x(),centre.y(),centre.z());
|
||||
const GLubyte* marker =
|
||||
G4OpenGLBitMapStore::GetBitMap(shape, size, filled);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||
glBitmap(size, size, size/2., size/2., 0., 0., marker);
|
||||
}
|
||||
else {
|
||||
winSize = scale *
|
||||
userSpecified ? marker.GetScreenSize() : def.GetScreenSize();
|
||||
}
|
||||
|
||||
// Prepare to draw in window coordinates...
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
gluOrtho2D(GLdouble(viewport[0]),
|
||||
GLdouble(viewport[0] + viewport[2]),
|
||||
GLdouble(viewport[1]),
|
||||
GLdouble(viewport[1] + viewport[3]));
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
// Draw in window coordinates...
|
||||
DrawScreenPolygon (winSize, G4Point3D(winx, winy, winz), nSides);
|
||||
|
||||
// Re-instate matrices...
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPopMatrix();
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
...
|
||||
}
|
||||
|
||||
void G4OpenGLSceneHandler::DrawScreenPolygon
|
||||
(G4double size,
|
||||
const G4Point3D& centre,
|
||||
G4int nSides) {
|
||||
glBegin (GL_POLYGON);
|
||||
const G4double dPhi = twopi / nSides;
|
||||
const G4double r = size / 2.;
|
||||
G4double phi;
|
||||
G4int i;
|
||||
for (i = 0, phi = -dPhi / 2.; i < nSides; i++, phi += dPhi) {
|
||||
G4double x, y, z;
|
||||
x = centre.x() + r * std::cos(phi);
|
||||
y = centre.y() + r * std::sin(phi);
|
||||
z = centre.z();
|
||||
glVertex3d (x, y, z);
|
||||
}
|
||||
glEnd ();
|
||||
}
|
||||
**********************************************/
|
||||
|
||||
void G4OpenGLSceneHandler::DrawXYPolygon
|
||||
(G4double size,
|
||||
(G4OpenGLBitMapStore::Shape shape,
|
||||
G4double size,
|
||||
const G4Point3D& centre,
|
||||
G4int nSides) {
|
||||
const G4VisAttributes* pApplicableVisAtts)
|
||||
{
|
||||
G4int nSides;
|
||||
G4double startPhi;
|
||||
if (shape == G4OpenGLBitMapStore::circle) {
|
||||
nSides = GetNoOfSides(pApplicableVisAtts);
|
||||
startPhi = 0.;
|
||||
} else {
|
||||
nSides = 4;
|
||||
startPhi = -pi / 4.;
|
||||
}
|
||||
|
||||
const G4Vector3D& viewpointDirection =
|
||||
fpViewer -> GetViewParameters().GetViewpointDirection();
|
||||
const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector();
|
||||
@@ -380,8 +288,9 @@ void G4OpenGLSceneHandler::DrawXYPolygon
|
||||
G4Vector3D start = radius * (up.cross(viewpointDirection)).unit();
|
||||
G4double phi;
|
||||
G4int i;
|
||||
|
||||
glBegin (GL_POLYGON);
|
||||
for (i = 0, phi = 0.; i < nSides; i++, phi += dPhi) {
|
||||
for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) {
|
||||
G4Vector3D r = start; r.rotate(phi, viewpointDirection);
|
||||
G4Vector3D p = centre + r;
|
||||
glVertex3d (p.x(), p.y(), p.z());
|
||||
@@ -409,7 +318,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
G4bool transparency_enabled = true;
|
||||
G4OpenGLViewer* pViewer = dynamic_cast<G4OpenGLViewer*>(fpViewer);
|
||||
if (pViewer) transparency_enabled = pViewer->transparency_enabled;
|
||||
const G4Colour& c = GetColour (polyhedron);
|
||||
const G4Colour& c = pVA->GetColour();
|
||||
GLfloat materialColour [4];
|
||||
materialColour [0] = c.GetRed ();
|
||||
materialColour [1] = c.GetGreen ();
|
||||
@@ -420,7 +329,7 @@ void G4OpenGLSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron) {
|
||||
materialColour [3] = 1.;
|
||||
}
|
||||
|
||||
G4double lineWidth = GetLineWidth(polyhedron);
|
||||
G4double lineWidth = GetLineWidth(pVA);
|
||||
glLineWidth(lineWidth);
|
||||
|
||||
GLfloat clear_colour[4];
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.31 2006/08/30 11:43:57 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLStoredSceneHandler.cc,v 1.32 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 10th February 1997
|
||||
@@ -211,7 +211,7 @@ void G4OpenGLStoredSceneHandler::BeginPrimitives2D()
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.20 2006/10/24 06:23:18 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLStoredViewer.cc,v 1.21 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -166,11 +166,11 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
}
|
||||
|
||||
// Display time at "head" of time range, which is fEndTime...
|
||||
if (fDisplayHeadTime && fEndTime < DBL_MAX) {
|
||||
if (fDisplayHeadTime && fEndTime < G4OPENGL_DBL_MAX) {
|
||||
glMatrixMode (GL_PROJECTION);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glOrtho (-1., 1., -1., 1., -DBL_MAX, DBL_MAX);
|
||||
glOrtho (-1., 1., -1., 1., -G4OPENGL_DBL_MAX, G4OPENGL_DBL_MAX);
|
||||
glMatrixMode (GL_MODELVIEW);
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
@@ -190,7 +190,7 @@ void G4OpenGLStoredViewer::DrawDisplayLists () {
|
||||
}
|
||||
|
||||
// Display light front...
|
||||
if (fDisplayLightFront && fEndTime < DBL_MAX) {
|
||||
if (fDisplayLightFront && fEndTime < G4OPENGL_DBL_MAX) {
|
||||
G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
|
||||
if (lightFrontRadius > 0.) {
|
||||
G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewer.cc,v 1.29 2006/09/19 16:13:15 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLViewer.cc,v 1.30 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 27th March 1996
|
||||
@@ -52,8 +52,8 @@ background (G4Colour(0.,0.,0.)),
|
||||
transparency_enabled (true),
|
||||
antialiasing_enabled (false),
|
||||
haloing_enabled (false),
|
||||
fStartTime(-DBL_MAX),
|
||||
fEndTime(DBL_MAX),
|
||||
fStartTime(-G4OPENGL_DBL_MAX),
|
||||
fEndTime(G4OPENGL_DBL_MAX),
|
||||
fFadeFactor(0.),
|
||||
fDisplayHeadTime(false),
|
||||
fDisplayHeadTimeX(-0.9),
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLViewerMessenger.cc,v 1.5 2006/10/24 06:20:42 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLViewerMessenger.cc,v 1.6 2007/02/08 14:01:55 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
|
||||
#include "G4OpenGLViewerMessenger.hh"
|
||||
|
||||
@@ -145,7 +145,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
new G4UIcommand("/vis/ogl/set/endTime", this);
|
||||
fpCommandEndTime->SetGuidance("Set end and range of track time.");
|
||||
parameter = new G4UIparameter ("end-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(DBL_MAX);
|
||||
parameter->SetDefaultValue(G4OPENGL_DBL_MAX);
|
||||
fpCommandEndTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("end-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
@@ -168,7 +168,7 @@ G4OpenGLViewerMessenger::G4OpenGLViewerMessenger()
|
||||
new G4UIcommand("/vis/ogl/set/startTime", this);
|
||||
fpCommandStartTime->SetGuidance("Set start and range of track time.");
|
||||
parameter = new G4UIparameter ("start-time", 'd', omitable = false);
|
||||
parameter->SetDefaultValue(-DBL_MAX);
|
||||
parameter->SetDefaultValue(-G4OPENGL_DBL_MAX);
|
||||
fpCommandStartTime->SetParameter(parameter);
|
||||
parameter = new G4UIparameter ("start-time-unit", 's', omitable = false);
|
||||
parameter->SetDefaultValue("ns");
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.34 2006/11/01 11:22:26 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-02 $
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.36 2007/02/08 13:47:22 allison Exp $
|
||||
// GEANT4 tag $Name: geant4-08-03 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -180,17 +180,27 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
|
||||
True);
|
||||
|
||||
if (status == 1) {
|
||||
cmap = 0;
|
||||
status = XGetRGBColormaps (dpy,
|
||||
XRootWindow (dpy, vi -> screen),
|
||||
&standardCmaps,
|
||||
&numCmaps,
|
||||
XA_RGB_DEFAULT_MAP);
|
||||
if (status == 1)
|
||||
for (i = 0; i < numCmaps; i++)
|
||||
for (i = 0; i < numCmaps; i++) {
|
||||
if (standardCmaps[i].visualid == vi -> visualid) {
|
||||
cmap = standardCmaps[i].colormap;
|
||||
XFree (standardCmaps);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!cmap) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr <<
|
||||
"G4OpenGLViewer::G4OpenGLViewer failed to allocate a standard colormap."
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
G4cout << "Got standard cmap" << G4endl;
|
||||
} else {
|
||||
cmap = XCreateColormap (dpy,
|
||||
@@ -344,7 +354,8 @@ G4OpenGLViewer (scene),
|
||||
print_colour (true),
|
||||
vectored_ps (true),
|
||||
vi_immediate (0),
|
||||
vi_stored (0)
|
||||
vi_stored (0),
|
||||
cmap (0)
|
||||
{
|
||||
|
||||
strcpy (print_string, "G4OpenGL.eps");
|
||||
@@ -479,7 +490,7 @@ void G4OpenGLXViewer::print() {
|
||||
win=glxpmap;
|
||||
|
||||
glXMakeCurrent (dpy,
|
||||
glxpmap,
|
||||
win,
|
||||
cx);
|
||||
|
||||
glViewport (0, 0, WinSize_x, WinSize_y);
|
||||
@@ -495,7 +506,7 @@ void G4OpenGLXViewer::print() {
|
||||
cx=tmp_cx;
|
||||
|
||||
glXMakeCurrent (dpy,
|
||||
glxpmap,
|
||||
win,
|
||||
cx);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user