39#define GL2PS_TEXT_B TOOLS_GL2PS_TEXT_B
40#define GL2PS_TEXT_BL TOOLS_GL2PS_TEXT_BL
41#define GL2PS_TEXT_BR TOOLS_GL2PS_TEXT_BR
62fOpenGLSceneHandler(scene),
64transparency_enabled (true),
65antialiasing_enabled (false),
66haloing_enabled (false),
71fDefaultExportImageFormat(
"pdf"),
72fExportImageFormat(
"pdf"),
73fExportFilenameIndex(0),
77fDefaultExportFilename(
"G4OpenGL"),
79fGl2psDefaultLineWith(1),
80fGl2psDefaultPointSize(2),
81fGlViewInitialized(false),
82fIsGettingPickInfos(false)
109 fExportFilename += fDefaultExportFilename +
"_" +
GetShortName().data();
133 glClearColor (0.0, 0.0, 0.0, 0.0);
135 glDisable (GL_LINE_SMOOTH);
136 glDisable (GL_POLYGON_SMOOTH);
142 glDepthFunc (GL_LEQUAL);
143 glDepthMask (GL_TRUE);
146 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
175 glClear (GL_COLOR_BUFFER_BIT);
176 glClear (GL_DEPTH_BUFFER_BIT);
177 glClear (GL_STENCIL_BUFFER_BIT);
185 fSizeHasChanged =
true;
187 fSizeHasChanged =
false;
204 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
206 if ((dims[0] !=0 ) && (dims[1] !=0)) {
209 G4cerr <<
"Try to resize view greater than max X viewport dimension. Desired size "<<
fWinSize_x <<
" is resize to "<< dims[0] <<
G4endl;
213 G4cerr <<
"Try to resize view greater than max Y viewport dimension. Desired size "<<
fWinSize_y <<
" is resize to "<< dims[1] <<
G4endl;
226 if (fIsGettingPickInfos)
return;
236 GLfloat lightPosition [4];
240 lightPosition [3] = 0.;
242 GLfloat ambient [] = { 0.2f, 0.2f, 0.2f, 1.f};
243 GLfloat diffuse [] = { 0.8f, 0.8f, 0.8f, 1.f};
244 glEnable (GL_LIGHT0);
245 glLightfv (GL_LIGHT0, GL_AMBIENT, ambient);
246 glLightfv (GL_LIGHT0, GL_DIFFUSE, diffuse);
263 if(radius<=0.) radius = 1.;
270 const GLdouble left = -right;
272 const GLdouble bottom = -top;
278 glMatrixMode (GL_PROJECTION);
282 glScaled(scaleFactor.
x(),scaleFactor.
y(),scaleFactor.
z());
285 g4GlOrtho (left, right, bottom, top, pnear, pfar);
288 g4GlFrustum (left, right, bottom, top, pnear, pfar);
291 glMatrixMode (GL_MODELVIEW);
296 if (cameraDistance > 1.e-6 * radius) {
297 gltarget = targetPoint;
303 const G4Point3D& pCamera = cameraPosition;
306 gltarget.
x(), gltarget.
y(), gltarget.
z(),
307 upVector.
x(), upVector.
y(), upVector.
z());
309 glLightfv (GL_LIGHT0, GL_POSITION, lightPosition);
341 size_t nPlanes = cutaways.size();
345 a[0] = cutaways[0].a();
346 a[1] = cutaways[0].b();
347 a[2] = cutaways[0].c();
348 a[3] = cutaways[0].d();
349 glClipPlane (GL_CLIP_PLANE2, a);
350 glEnable (GL_CLIP_PLANE2);
352 a[0] = cutaways[1].a();
353 a[1] = cutaways[1].b();
354 a[2] = cutaways[1].c();
355 a[3] = cutaways[1].d();
356 glClipPlane (GL_CLIP_PLANE3, a);
357 glEnable (GL_CLIP_PLANE3);
360 a[0] = cutaways[2].a();
361 a[1] = cutaways[2].b();
362 a[2] = cutaways[2].c();
363 a[3] = cutaways[2].d();
364 glClipPlane (GL_CLIP_PLANE4, a);
365 glEnable (GL_CLIP_PLANE4);
368 glDisable (GL_CLIP_PLANE2);
369 glDisable (GL_CLIP_PLANE3);
370 glDisable (GL_CLIP_PLANE4);
397 glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
400 glDepthMask (GL_TRUE);
401 glDepthFunc (GL_LESS);
412 glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
413 glDepthFunc (GL_LEQUAL);
420 const std::vector < G4OpenGLViewerPickMap* > & pickMap =
GetPickDetails(x,y);
422 if (pickMap.size() == 0) {
425 for (
unsigned int a=0; a < pickMap.size(); a++) {
426 if (pickMap[a]->getAttributes().size() > 0) {
427 txt += pickMap[a]->print();
436 static std::vector < G4OpenGLViewerPickMap* > pickMapVector;
437 for (
auto pickMap: pickMapVector) {
440 pickMapVector.clear();
442 const G4int BUFSIZE = 512;
443 GLuint selectBuffer[BUFSIZE];
444 glSelectBuffer(BUFSIZE, selectBuffer);
445 glRenderMode(GL_SELECT);
448 glMatrixMode(GL_PROJECTION);
449 G4double currentProjectionMatrix[16];
450 glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
454 glGetIntegerv(GL_VIEWPORT, viewport);
461 fIsGettingPickInfos =
true;
464 glMultMatrixd(currentProjectionMatrix);
465 glMatrixMode(GL_MODELVIEW);
467 GLint hits = glRenderMode(GL_RENDER);
468 fIsGettingPickInfos =
false;
470 G4cout <<
"Too many hits. Zoom in to reduce overlaps." <<
G4endl;
471 goto restoreMatrices;
474 GLuint* p = selectBuffer;
475 for (GLint i = 0; i < hits; ++i) {
476 GLuint nnames = *p++;
485 for (GLuint j = 0; j < nnames; ++j) {
487 std::map<GLuint, G4AttHolder*>::iterator iter =
491 if(attHolder && attHolder->
GetAttDefs().size()) {
492 for (
size_t iAtt = 0;
493 iAtt < attHolder->
GetAttDefs().size(); ++iAtt) {
494 std::ostringstream oss;
508 pickMapVector.push_back(pickMap);
517 glMatrixMode(GL_PROJECTION);
519 glMatrixMode(GL_MODELVIEW);
521 return pickMapVector;
524GLubyte* G4OpenGLViewer::grabPixels
525(
int inColor,
unsigned int width,
unsigned int height) {
528 GLint swapbytes, lsbfirst, rowlength;
529 GLint skiprows, skippixels, alignment;
535 size = width*height*3;
537 format = GL_LUMINANCE;
538 size = width*height*1;
541 buffer =
new GLubyte[size];
545 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
546 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
547 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
549 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
550 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
551 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
553 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
554 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
555 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
557 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
558 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
559 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
561 glReadBuffer(GL_FRONT);
562 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
564 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
565 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
566 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
568 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
569 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
570 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
575bool G4OpenGLViewer::printVectoredEPS() {
579bool G4OpenGLViewer::printNonVectoredEPS () {
581 int width = getRealExportWidth();
582 int height = getRealExportHeight();
587 int components,
pos, i;
591 if (pixels == NULL) {
592 G4cerr <<
"Failed to get pixels from OpenGl viewport" <<
G4endl;
601 fp = fopen (
name.c_str(),
"w");
607 fprintf (fp,
"%%!PS-Adobe-2.0 EPSF-1.2\n");
608 fprintf (fp,
"%%%%Title: %s\n",
name.c_str());
609 fprintf (fp,
"%%%%Creator: OpenGL pixmap render output\n");
610 fprintf (fp,
"%%%%BoundingBox: 0 0 %d %d\n", width, height);
611 fprintf (fp,
"%%%%EndComments\n");
612 fprintf (fp,
"gsave\n");
613 fprintf (fp,
"/bwproc {\n");
614 fprintf (fp,
" rgbproc\n");
615 fprintf (fp,
" dup length 3 idiv string 0 3 0 \n");
616 fprintf (fp,
" 5 -1 roll {\n");
617 fprintf (fp,
" add 2 1 roll 1 sub dup 0 eq\n");
618 fprintf (fp,
" { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
619 fprintf (fp,
" 3 1 roll 5 -1 roll } put 1 add 3 0 \n");
620 fprintf (fp,
" { 2 1 roll } ifelse\n");
621 fprintf (fp,
" }forall\n");
622 fprintf (fp,
" pop pop pop\n");
623 fprintf (fp,
"} def\n");
624 fprintf (fp,
"systemdict /colorimage known not {\n");
625 fprintf (fp,
" /colorimage {\n");
626 fprintf (fp,
" pop\n");
627 fprintf (fp,
" pop\n");
628 fprintf (fp,
" /rgbproc exch def\n");
629 fprintf (fp,
" { bwproc } image\n");
630 fprintf (fp,
" } def\n");
631 fprintf (fp,
"} if\n");
632 fprintf (fp,
"/picstr %d string def\n", width * components);
633 fprintf (fp,
"%d %d scale\n", width, height);
634 fprintf (fp,
"%d %d %d\n", width, height, 8);
635 fprintf (fp,
"[%d 0 0 %d 0 0]\n", width, height);
636 fprintf (fp,
"{currentfile picstr readhexstring pop}\n");
637 fprintf (fp,
"false %d\n", components);
638 fprintf (fp,
"colorimage\n");
640 curpix = (GLubyte*) pixels;
642 for (i = width*height*components; i>0; i--) {
643 fprintf (fp,
"%02hx ", (
unsigned short)(*(curpix++)));
652 fprintf (fp,
"grestore\n");
653 fprintf (fp,
"showpage\n");
678#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
681#ifdef G4VIS_BUILD_OPENGLX_DRIVER
684#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
687#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
691#if GL_ARB_framebuffer_object
728 static G4int callCount = 0;
731 if (callCount <= 1) {
733 "G4OpenGLViewer::DrawText: Not implemented for \""
779 if ((width != -1) && (height != -1)) {
800 size_t len = strlen(setlocale(LC_NUMERIC,NULL));
801 char* oldLocale = (
char*)(malloc(len+1));
802 if(oldLocale!=NULL) strncpy(oldLocale,setlocale(LC_NUMERIC,NULL),len);
803 setlocale(LC_NUMERIC,
"C");
806 res = printNonVectoredEPS();
808 res = printVectoredEPS();
813 setlocale(LC_NUMERIC,oldLocale);
832bool G4OpenGLViewer::printGl2PS() {
834 int width = getRealExportWidth();
835 int height = getRealExportHeight();
862 bool extendBuffer =
true;
863 bool endWriteAction =
false;
864 bool beginWriteAction =
true;
865 bool filePointerOk =
true;
866 while ((extendBuffer) && (! endWriteAction) && (filePointerOk)) {
869 if(beginWriteAction) {
871 ::glGetIntegerv(GL_VIEWPORT,vp);
883 if (beginWriteAction) {
897 if ((! endWriteAction) || (! beginWriteAction)) {
904 if (!extendBuffer ) {
905 G4cerr <<
"ERROR: gl2ps buffer size is not big enough to print this geometry. Try to extend it. No output produced"<<
G4endl;
908 if (!beginWriteAction ) {
912 if (!endWriteAction ) {
937 return fSizeHasChanged;
940G4int G4OpenGLViewer::getRealExportWidth() {
945 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
948 if ((dims[0] !=0 ) && (dims[1] !=0)) {
959G4int G4OpenGLViewer::getRealExportHeight() {
964 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
967 if ((dims[0] !=0 ) && (dims[1] !=0)) {
995 if ((name !=
"") && (fExportFilename != name)) {
1002 if (name.size() == 0) {
1006 std::string extension = name.substr(name.find_last_of(
".") + 1);
1008 if (extension.size() >= 3 && extension.size() <= 4) {
1010 fExportFilename = name.substr(0,name.find_last_of(
"."));
1015 fExportFilename = name;
1022 std::string temp = fExportFilename;
1024 temp += std::string(
"_");
1025 std::ostringstream os;
1027 std::string nb_str = os.str();
1043 if(radius<=0.) radius = 1.;
1058 if(radius<=0.) radius = 1.;
1075 if(radius<=0.) radius = 1.;
1086 rotateSceneInViewDirection(dx,dy);
1089 rotateSceneThetaPhi(dx,0);
1092 rotateSceneThetaPhi(0,dy);
1101 rotateSceneInViewDirection(dx,dy);
1104 rotateSceneThetaPhi(dx,0);
1107 rotateSceneThetaPhi(0,dy);
1156 delta_alpha *= CLHEP::deg;
1157 delta_theta *= CLHEP::deg;
1159 new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
1166 if (new_vp.
z()*vp.
z() <0) {
1167 new_up.
set(new_up.
x(),-new_up.
y(),new_up.
z());
1171 if (new_vp.
z()*vp.
z() <0) {
1172 new_up.
set(new_up.
x(),-new_up.
y(),new_up.
z());
1179 cosalpha = new_up.
dot (new_vp.
unit());
1180 sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
1182 xprime = yprime.
cross (new_up);
1184 a1 = sinalpha * xprime;
1186 a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
1190 viewPoint = new_vp.
unit() + delta;
1226 up.
z()*vp.
x()-up.
x()*vp.
z(),
1227 up.
x()*vp.
y()-up.
y()*vp.
x());
1229 viewPoint = vp/
fRot_sens + (zPrimeVector*dx - up*dy) ;
1230 new_up =
G4Vector3D(viewPoint.
y()*zPrimeVector.
z()-viewPoint.
z()*zPrimeVector.
y(),
1231 viewPoint.
z()*zPrimeVector.
x()-viewPoint.
x()*zPrimeVector.
z(),
1232 viewPoint.
x()*zPrimeVector.
y()-viewPoint.
y()*zPrimeVector.
x());
1255 G4cout <<
" Changing export format to \"" << format <<
"\"" <<
G4endl;
1265 if (format.size() == 0) {
1266 G4cout <<
" Current formats availables are : " << list <<
G4endl;
1268 G4cerr <<
" Format \"" << format <<
"\" is not available for the selected viewer. Current formats availables are : " << list <<
G4endl;
1285 sx = viewport[2] / width;
1286 sy = viewport[3] / height;
1287 tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
1288 ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
1290#define M(row, col) mat[col*4+row]
1321 GLdouble centerx, GLdouble centery, GLdouble
1323 GLdouble upx, GLdouble upy, GLdouble upz )
1326 GLdouble x[3], y[3], z[3];
1332 z[0] = eyex - centerx;
1333 z[1] = eyey - centery;
1334 z[2] = eyez - centerz;
1335 mag = std::sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
1348 x[0] = y[1] * z[2] - y[2] * z[1];
1349 x[1] = -y[0] * z[2] + y[2] * z[0];
1350 x[2] = y[0] * z[1] - y[1] * z[0];
1353 y[0] = z[1] * x[2] - z[2] * x[1];
1354 y[1] = -z[0] * x[2] + z[2] * x[0];
1355 y[2] = z[0] * x[1] - z[1] * x[0];
1362 mag = std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
1369 mag = std::sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
1376#define M(row,col) mat[col*4+row]
1397 glTranslated(-eyex, -eyey, -eyez);
1403 GLdouble a = 2.0 / (right - left);
1404 GLdouble b = 2.0 / (top - bottom);
1405 GLdouble c = -2.0 / (zFar - zNear);
1407 GLdouble tx = - (right + left)/(right - left);
1408 GLdouble ty = - (top + bottom)/(top - bottom);
1409 GLdouble tz = - (zFar + zNear)/(zFar - zNear);
1411 GLdouble ortho[16] = {
1417 glMultMatrixd(ortho);
1425 GLdouble deltaX = right - left;
1426 GLdouble deltaY = top - bottom;
1427 GLdouble deltaZ = zFar - zNear;
1429 GLdouble a = 2.0f * zNear / deltaX;
1430 GLdouble b = 2.0f * zNear / deltaY;
1431 GLdouble c = (right + left) / deltaX;
1432 GLdouble d = (top + bottom) / deltaY;
1433 GLdouble e = -(zFar + zNear) / (zFar - zNear);
1434 GLdouble f = -2.0f * zFar * zNear / deltaZ;
1436 GLdouble proj[16] = {
1443 glMultMatrixd(proj);
1448 std::ostringstream txt;
1449 for (
unsigned int a=0; a<fAttributes.size(); a++) {
1450 txt << fAttributes[a];
1451 if (a < fAttributes.size() - 1) txt <<
"\n";
G4double Y(G4double density)
HepGeom::Vector3D< G4double > G4Vector3D
std::vector< G4Plane3D > G4Planes
G4GLOB_DLL std::ostream G4cerr
G4GLOB_DLL std::ostream G4cout
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
G4double GetGreen() const
static void SetFlushAction(FlushAction action)
static FlushAction GetFlushAction()
std::map< GLuint, G4AttHolder * > fPickMap
void setSubHitNumber(G4int n)
void setHitNumber(G4int n)
void addAttributes(G4String att)
void setPickName(G4int n)
void g4GluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
void g4GlFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
std::vector< std::string > fExportImageFormatVector
void g4GluLookAt(GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
void rotateSceneToggle(G4double dx, G4double dy)
bool setExportImageFormat(std::string format, bool quiet=false)
unsigned int getWinHeight() const
std::string fExportImageFormat
void ClearViewWithoutFlush()
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
bool setExportFilename(G4String name, G4bool inc=true)
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
void addExportImageFormat(std::string format)
void ChangeLineWidth(G4double width)
virtual void DrawText(const G4Text &)
GLdouble getSceneFarWidth()
void setExportSize(G4int, G4int)
virtual G4String Pick(GLdouble x, GLdouble y)
void rotateScene(G4double dx, G4double dy)
void ChangePointSize(G4double size)
G4bool isFramebufferReady()
virtual bool exportImage(std::string name="", int width=-1, int height=-1)
void g4GlOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
G4OpenGLSceneHandler & fOpenGLSceneHandler
virtual ~G4OpenGLViewer()
std::string getRealPrintFilename()
GLdouble getSceneNearWidth()
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails(GLdouble x, GLdouble y)
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
G4Point3D GetPosition() const
G4Scene * GetScene() const
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)
virtual void DrawView()=0
G4VSceneHandler & fSceneHandler
G4ViewParameters fDefaultVP
const G4String & GetShortName() const
virtual void FinishView()
void SetViewAndLights(const G4Vector3D &viewpointDirection)
const G4Vector3D & GetScaleFactor() const
void SetAutoRefresh(G4bool)
CutawayMode GetCutawayMode() const
G4double GetCameraDistance(G4double radius) const
unsigned int GetWindowSizeHintX() const
G4Vector3D & GetActualLightpointDirection()
const G4Colour & GetBackgroundColour() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetFieldHalfAngle() const
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const
const G4Vector3D & GetUpVector() const
void SetUpVector(const G4Vector3D &upVector)
const G4Planes & GetCutawayPlanes() const
RotationStyle GetRotationStyle() const
unsigned int GetWindowSizeHintY() const
G4bool GetLightsMoveWithCamera() const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const
G4double GetExtentRadius() const
void setOpenGLFunctions(tools_gl2ps_gl_funcs_t *)
void disableFileWriting()
bool fileWritingEnabled() const
void resetBufferSizeParameters()
void setExportImageFormat_SVG()
void setExportImageFormat_PDF()
void setFileName(const char *)
void addTextOpt(const char *, const char *, tools_GLshort, tools_GLint, tools_GLfloat)
void setExportImageFormat_PS()
void setViewport(int, int, int, int)
void setExportImageFormat_EPS()
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
BasicVector3D< T > unit() const
void set(T x1, T y1, T z1)
T dot(const BasicVector3D< T > &v) const
tools_GLint(* tools_glRenderMode_func)(tools_GLenum)
void(* tools_glVertex3f_func)(tools_GLfloat, tools_GLfloat, tools_GLfloat)
void(* tools_glGetFloatv_func)(tools_GLenum, tools_GLfloat *)
void(* tools_glBegin_func)(tools_GLenum)
void(* tools_glFeedbackBuffer_func)(tools_GLsizei, tools_GLenum, tools_GLfloat *)
void(* tools_glPassThrough_func)(tools_GLfloat)
void(* tools_glGetBooleanv_func)(tools_GLenum, tools_GLboolean *)
void(* tools_glEnd_func)()
void(* tools_glGetIntegerv_func)(tools_GLenum, tools_GLint *)
tools_GLboolean(* tools_glIsEnabled_func)(tools_GLenum)
const char * name(G4int ptype)