Import Geant4 1.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.4.8.1 1999/12/07 20:53:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-01-00 $
|
||||
// $Id: G4OpenGLXViewer.cc,v 1.6 1999/12/15 18:08:30 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-01-01 $
|
||||
//
|
||||
//
|
||||
// Andrew Walkden 7th February 1997
|
||||
@@ -44,8 +44,11 @@
|
||||
#define USE_DEFAULT_COLORMAP 1
|
||||
#define USE_STANDARD_COLORMAP 0
|
||||
|
||||
static Bool WaitForNotify (Display*, XEvent* e, char* arg) {
|
||||
return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
|
||||
extern "C"
|
||||
{
|
||||
static Bool WaitForNotify (Display*, XEvent* e, char* arg) {
|
||||
return (e->type == MapNotify) && (e->xmap.window == (Window) arg);
|
||||
}
|
||||
}
|
||||
|
||||
void G4OpenGLXViewer::SetView () {
|
||||
@@ -73,7 +76,7 @@ void G4OpenGLXViewer::GetXConnection () {
|
||||
dpy = XOpenDisplay (0);
|
||||
if (!dpy) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't open display." << endl;
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't open display." << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -81,7 +84,7 @@ void G4OpenGLXViewer::GetXConnection () {
|
||||
if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer X Server has no GLX extension."
|
||||
<< endl;
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -93,7 +96,7 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
|
||||
if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't return window attributes"
|
||||
<< endl;
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +105,7 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
|
||||
if (!cx) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer couldn't create context."
|
||||
<< endl;
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -132,19 +135,19 @@ void G4OpenGLXViewer::CreateGLXContext (XVisualInfo* v) {
|
||||
cmap = standardCmaps[i].colormap;
|
||||
XFree (standardCmaps);
|
||||
}
|
||||
G4cout << "Got standard cmap" << endl;
|
||||
G4cout << "Got standard cmap" << G4endl;
|
||||
} else {
|
||||
cmap = XCreateColormap (dpy,
|
||||
XRootWindow(dpy, vi -> screen),
|
||||
vi -> visual,
|
||||
AllocNone);
|
||||
G4cout << "Created own cmap" << endl;
|
||||
G4cout << "Created own cmap" << G4endl;
|
||||
}
|
||||
|
||||
if (!cmap) {
|
||||
fViewId = -1; // This flags an error.
|
||||
G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap."
|
||||
<< endl;
|
||||
<< G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -174,7 +177,7 @@ void G4OpenGLXViewer::CreateMainWindow () {
|
||||
WinSize_y = fVP.GetWindowSizeHintY ();
|
||||
x_origin = xwa.x;
|
||||
y_origin = xwa.y;
|
||||
G4cout << "Window name: " << fName << endl;
|
||||
G4cout << "Window name: " << fName << G4endl;
|
||||
strncpy (charViewName, fName, 100);
|
||||
char *window_name = charViewName;
|
||||
char *icon_name = charViewName;
|
||||
@@ -273,7 +276,7 @@ G4OpenGLXViewer::~G4OpenGLXViewer () {
|
||||
|
||||
void G4OpenGLXViewer::print() {
|
||||
|
||||
//cout << "print_col_callback requested with file name: " << print_string << endl;
|
||||
//cout << "print_col_callback requested with file name: " << print_string << G4endl;
|
||||
|
||||
if (vectored_ps) {
|
||||
G4int size = 5000000;
|
||||
@@ -651,19 +654,22 @@ typedef struct _DepthIndex {
|
||||
GLfloat depth;
|
||||
} DepthIndex;
|
||||
|
||||
static int
|
||||
compare(const void *a, const void *b)
|
||||
extern "C"
|
||||
{
|
||||
DepthIndex *p1 = (DepthIndex *) a;
|
||||
DepthIndex *p2 = (DepthIndex *) b;
|
||||
GLfloat diff = p2->depth - p1->depth;
|
||||
static int
|
||||
compare(const void *a, const void *b)
|
||||
{
|
||||
DepthIndex *p1 = (DepthIndex *) a;
|
||||
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;
|
||||
if (diff > 0.0) {
|
||||
return 1;
|
||||
} else if (diff < 0.0) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user