Problem 1866

Summary: Compatibility problems with Qt-OpenGL and GDML geometry definition for Windows
Product: Geant4 Reporter: Pete Truscott <PRTruscott>
Component: visualizationAssignee: Brian Smith <Brian.Smith>
Status: RESOLVED FIXED    
Severity: normal CC: John.Allison, laurent.garnier
Priority: P5    
Version: 10.2   
Hardware: PC   
OS: Windows   
Attachments: B1gdml source and build, and example screenshot output

Description Pete Truscott 2016-06-03 11:21:30 CEST
Created attachment 402 [details]
B1gdml source and build, and example screenshot output

As part of the ESA CIRSOS Project we need to be able to visualise GDML geometries within the MS Windows 7.  I have applications (part of this is ESA's GRAS application), which allow GDML geometry visualisation, and this works fine under Linux when using OpenGL-Qt environment, but either crashes or makes the volumes invisible under Windows 7.

To demonstrate this in a small example, I’ve taken the Basic Example B1 and replaced the geometry with the GDML reader (using GRASGDMLDetectorConstruction).  The example is called B1gdml (file B1gdml_example+figures.zip attached).  I also attach images:

- Figure 1 is the normal B1 example (non-GDML) which I get when using my Windows 7 - everything seems OK.
- Figure 2 shows the case for the Win32 MSVC build (no geometry visible)
- Figure 3 shows a representation of what I see using a OpenSuSE Linux build (geometry can be seen and also “touchables” appears within the “scene tree” widget list).  This strongly indicates a problem originating more within Geant4.

My and Fan Lei's experience with other MS Windows 7 using other G4 applications that use Qt-OpenGL and GDML is similar - invisible geometries, or the application crashes.

The configurations for the build were:
- Windows 7, Service Pack 1, MSVC using MS Visual Studio 2010 Express, Qt v4.8.6
- OpenSuSE v13.2, GCC v4.8.6, Qt v4.8

My first thoughts are that the problems occur in the overlap between the geometry/GDML and vis categories (rather than one of these only).  Your assistance in this matter will be much appreciated.
Comment 1 Brian Smith 2016-09-16 16:17:22 CEST
The problem was in the use of the static instance of G4VisAttributes::Invisible in G4GDMLReadStructure.  G4VisAttributes::Invisible to be deprecated and the method G4VisAttributes::GetInvisible() to be used instead.

Incorrect initialisation of static instance:
const G4VisAttributes  G4VisAttributes::Invisible = G4VisAttributes (false);

Correct use of static instance:
const G4VisAttributes& G4VisAttributes::GetInvisible() {
  static const G4VisAttributes invisible = G4VisAttributes(false);
  return invisible;
}