Visualization does not appear in Geant4.11.1.0 under Windows

Dear all,
I’m attempting to run exampleB1.exe in Gant 4.11.1.0 under Windows. I notice that run1.mac is working well. However, there is no visualization popping up and I am not able to see the detector. Simillarly for /vis.mac. Please see the below message. Please note I don’t use QT.

Is there anyone who use Geant4.11.1 under windows os?

Best regards,


Geant4 version Name: geant4-11-01 (9-December-2022)
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


<<< Reference Physics List QBBC
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

ou have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)

Registering model factories…

ou have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

egistered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

egistered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
/vis/list" to see available colours.
ERROR: Can not open a macro file <init_vis.mac>. Set macro path with “/control/macroPath” if needed.

------- WWWW ------- G4Exception-START -------- WWWW -------
** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
ommand aborted (400)
rror code : 400
** This is just a warning message. ***
------- WWWW -------- G4Exception-END --------- WWWW -------
parameter value (OGL) is not listed in the candidate List.
Candidates are: ASCIITree ATree DAWNFILE G4HepRepFile HepRepFile RayTracer VRML2FILE gMocrenFile TOOLSSG_OFFSCREEN TSG_OFFSCREEN TOOLSSG_OFFSCREEN TSG_OFFSCREEN TSG_FILE

------- WWWW ------- G4Exception-START -------- WWWW -------
** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
nvoked command has failed - see above. Available graphics systems are:
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
Error code : 500
** This is just a warning message. ***
------- WWWW -------- G4Exception-END --------- WWWW -------
***** Illegal parameter (0) </vis/open OGL 600x600-0+0> *****

***** Batch is interrupted!! *****

------- WWWW ------- G4Exception-START -------- WWWW -------
** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
ommand aborted (500)
rror code : 500
** This is just a warning message. ***
------- WWWW -------- G4Exception-END --------- WWWW -------
command refused (500):“/control/execute D:\Research\Geant4\Geant4\geant4-v11.1.0\geant4-v11.1.0\examples\basic\test\B1\build\vis.mac”

As logged by the application here:

it doesn’t have access to any non-file based driver. Without Qt, the best way to have a direct vis is with the OpenGL driver. This requires:

  1. The Geant4 libraries to be configured with the CMake option GEANT4_USE_OPENGL_WIN32 set to ON. That can be done as outlined in the Install Guide
  2. The application uses CMake, and finds Geant4 using find_package(Geant4 REQUIRED ui_all vis_all). If you’re just building B1 as-is with no modification, then this is done automatically for you.

Dear @bmorgan ,
Thank you for your reply.
I understand, from your comment, that GEANT4_USE_OPENGL_WIN32 needs to be set to ON.
I open “Geant4Config.cmake” that locates in “C:\Users\morad.hamad\Geant4\lib\cmake\Geant4” and change OFF to ON (as shown in the attached). However, I got the following error:

CMake Error at CMakeLists.txt:36 (target_link_libraries):
Target “exampleB1” links to:

Geant4::G4OpenGL

but the target was not found. Possible reasons include:

* There is a typo in the target name.
* A find_package call is missing for an IMPORTED target.
* An ALIAS target is missing.

Inside the CMakeList.txt file if we go to the line 36: we find:
#----------------------------------------------------------------------------

Add the executable, and link it to the Geant4 libraries

add_executable(exampleB1 exampleB1.cc ${sources} ${headers})
target_link_libraries(exampleB1 ${Geant4_LIBRARIES})

#----------------------------------------------------------------------------

Does this information helpful in finding the problem?

Thank you

Dear @bmorgan ,

It works well know!
I removed the geant4 from my PC, then I recompile it making GEANT4_USE_OPENGL_WIN32 set to ON from the beginning. I am able to see the visualization when running \vis.mac.

One more thing, if you allow me:

when I run the exampleB1.exe I receive the following error. Does it affect any future running If I want to creat my own code?

Big Thank you!


Geant4 version Name: geant4-11-01 [MT] (9-December-2022)
<< in Multi-threaded mode >>
Copyright : Geant4 Collaboration
References : NIM A 506 (2003), 250-303
: IEEE-TNS 53 (2006), 270-278
: NIM A 835 (2016), 186-225
WWW : http://geant4.org/


<<< Reference Physics List QBBC
Visualization Manager instantiating with verbosity “warnings (3)”…
Visualization Manager initialising…
Registering graphics systems…

ou have successfully registered the following graphics systems.
Registered graphics systems are:
ASCIITree (ATree)
DAWNFILE (DAWNFILE)
G4HepRepFile (HepRepFile)
RayTracer (RayTracer)
VRML2FILE (VRML2FILE)
gMocrenFile (gMocrenFile)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN)
TOOLSSG_OFFSCREEN (TSG_OFFSCREEN, TSG_FILE)
OpenGLImmediateWin32 (OGLIWin32, OGLI)
OpenGLStoredWin32 (OGLSWin32, OGL, OGLS)
TOOLSSG_WINDOWS_GLES (TSG_WINDOWS_GLES, TSG)

Registering model factories…

ou have successfully registered the following model factories.
Registered model factories:
generic
drawByAttribute
drawByCharge
drawByOriginVolume
drawByParticleID
drawByEncounteredVolume

egistered models:
None

Registered filter factories:
attributeFilter
chargeFilter
originVolumeFilter
particleFilter
encounteredVolumeFilter

egistered filters:
None

You have successfully registered the following user vis actions.
Run Duration User Vis Actions: none
End of Event User Vis Actions: none
End of Run User Vis Actions: none

Some /vis commands (optionally) take a string to specify colour.
/vis/list" to see available colours.
ERROR: Can not open a macro file <init_vis.mac>. Set macro path with “/control/macroPath” if needed.

------- WWWW ------- G4Exception-START -------- WWWW -------
** G4Exception : UIMAN0123
issued by : G4UImanager::ApplyCommand
ommand aborted (400)
rror code : 400
** This is just a warning message. ***
------- WWWW -------- G4Exception-END --------- WWWW -------

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.