OpenGL Visualization Issues

Hi All,
I am having issues using OpenGL for interactive visualization of detector geometry. I have no issues using RayTracer, DAWNFILE, etc., but I am not able to use any interactive GUIs (I would like to use OGLIX).

I am using Geant4.10.06 on a server running SLC7. For downloading Geant, I used the directions here:

In addition to those directions, I have ensured that I have the environment variables G4VIS_BUILD_OPENGLX_DRIVER and G4_VIS_USE_OPENGLX set correctly during my build. Despite this, I don’t think the OpenGL visualization driver is getting built properly and it is definitely not accessible from with Geant.

I am able to see GUIs from other programs (for example, ROOT), so I believe this is an issue with the way Geant is built on my system or a problem with one of the drivers.

I would really appreciate any suggestions or help you all could provide!


Hi Stephen

Building: Using cmake?: You need to specify GEANT4_USE_OPENGL_X11 with the -D option. Can you confirm that you are doing this?

Running: the environment variables you mention are no longer required.

Running over the network: Are you using ssh -X (or better, ssh -Y)? And is GLX enabled on your local X11?

Let us know if this helps.


Hi John,
Thanks so much for your help. I am using ssh -Y, but I was not previously using the -DGEANT4_USE_OPENGL_X11 option when building with cmake.

Using this options with cmake gives the following error after executing the make command:

fatal error: GL/gl.h: No such file or directory.

As simple as this issue is, I’m not sure I know enough about OpenGL to fix it. Please let me know if you have any suggestions about how I can fix it.

Thanks again,

Did you rebuild from scratch? I think that should fix it.

Or maybe OpenGL is not installed on your server. Could you consult your system manager? What operating system does it use?

I rebuilt from scratch, and this did not solve the issue.

I checked with the system manager, and OpenGL is installed on the server.
I added find_package(OpenGL REQUIRED)
to the main CMakeLists.txt file and it finds it ok. Perhaps there is something else I need to add to this file?

Which “main CMakeLists.txt” did you add the find_package to? Could you please post the output from:

  1. Running CMake to build Geant4 itself, including the command line you used
  2. Running CMake to build your application, including the command line you used

I think I have solved the issue.

I am using conda enviornment manager, so I the "#include " directive was searching by default only within my conda enviornment. I added a link to the system GL directory inside by conda directory, and this solved the issue.

Thanks for your help!

Actually, it seems like OGLIX is still not listed in the candidate list for visualization, despite building with the -DGEANT4_USE_OPENGL_X11=ON option, and having no errors building or installing.

Any idea what could be the issue?