OGL Visualisation Illegal Parameter Error

Geant4 Version: 11.1.2
Operating System: 14.6
Compiler/Version: AppleClang 15.0.0.15000309
CMake Version: 3.30.1


Hi all,

I’m receiving the following visualisation error when I run my own Geant4 (v11.1.2) simulation (on mac):

/vis/open OGL 600x600-0+0
/vis/sceneHandler/create OGL
WARNING: G4VisCommandSceneHandlerCreate::SetNewValue:
  Using fallback graphics system: OpenGLStoredX (OGLSX)
/vis/viewer/create ! ! 600x600-0+0
G4OpenGLXViewer::G4OpenGLXViewer: unable to get a single buffer visual.
G4OpenGLXViewer::G4OpenGLXViewer: unable to get a double buffer visual.
G4OpenGLXViewer::G4OpenGLXViewer: unable to get required visuals.
G4OpenGLStoredX::CreateViewer: error flagged by negative view id in G4OpenGLStoredXViewer creation.
 Destroying view and returning null pointer.
ERROR in G4VisManager::CreateViewer: null pointer during OpenGLStoredX viewer creation.
  No action taken.

:

***** Illegal parameter (1) </vis/open OGL 600x600-0+0> *****

I built Geant4 using cmake (v3.30.1) and the following flags:

-DGEANT4_INSTALL_DATA=ON 
-DGEANT4_USE_QT=ON
-DGEANT4_USE_OPENGL_X11=ON
-DGEANT4_INSTALL_PACKAGE_CACHE=OFF
-DCMAKE_INSTALL_PREFIX=../geant4-v11.1.2-install
-DCMAKE_PREFIX_PATH="/opt/homebrew/Cellar/qt@5/5.15.13_1"

I received the same error when I ran ./exampleB1 init_vis.mac but no error when I ran ./exampleB1. My simulation was built with the following flags:

-DCMAKE_INSTALL_PREFIX=../geant4-v11.1.2-install 
-DGEANT4_USE_QT=ON 
-DGEANT4_USE_OPENGL_X11=ON 
-DCMAKE_PREFIX_PATH="/opt/homebrew/Cellar/qt@5/5.15.13_1"

Does anyone know how to fix this?

Also, I recently upgraded my macOS from Monterey to Sonoma 14.6. The error only arose after the update; I had no problems with the visualisations previously. Could the upgrade have caused the problem or is it something else?

Kind regards,

Lysander

Hi Lysander

There is a problem that has been around a while, I suspect, but recently showed up on Sonoma. Installing Qt with homebrew brings brew’s version of X11. I am guessing you also have XQuartz installed. This confuses cmake. If you ccmake ., and toggle advanced mode, you will see that some X11 libraries are picked from one, some from the other. The only workaround we have is to go into ccmake and change all paths to /usr/X11/... (or specify a dozen -D options to the same effect). At the moment, because of this, I am simply building without -DGEANT4_USE_OPENGL_X11=ON at the moment.

However, the first error shows that your app used an X11 “fallback”, and fell upon the above problem. The question I have is, why did it request the fallback system? If you build with Qt, /vis/open OGL will open, or attempt to open, OGLSQt. In your case, it has found that this is not possible, and tried the fallback. Did you request a plain terminal session, e.g., tcsh with some environment variable, or ~/.g4session? OGLSQt requires a Qt session.

So if you want a Qt session (I mean, a Qt GUI), build without X11, and use the Qt GUI. Or if you want a terminal session (issuing commands on the normal terminal window), build with X11 and without Qt.

Hope this helps
John

Hi John,

I was able to get the visualisation working using X11. I built without QT and changed all the paths to /usr/X11/... in ccmake like you suggested and it worked. Thank you for the help.

I’m not sure why it requested a fallback system originally; I used a plain terminal session.

Kind regards,

Lysander