ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4OpenGLXViewer.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4OpenGLXViewer.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 // Andrew Walkden 7th February 1997
30 // G4OpenGLXViewer : Class to provide XWindows specific
31 // functionality for OpenGL in GEANT4
32 
33 #if defined (G4VIS_BUILD_OPENGLX_DRIVER) || defined (G4VIS_USE_OPENGLX)
34 
35 #ifndef G4OPENGLXVIEWER_HH
36 #define G4OPENGLXVIEWER_HH
37 
38 #include "G4OpenGLViewer.hh"
39 #include "globals.hh"
40 
41 #include <X11/Intrinsic.h>
42 
43 #include "G4OpenGL.hh"
44 #include <GL/glx.h>
45 
46 class G4OpenGLSceneHandler;
47 class G4Text;
48 
49 class G4OpenGLXViewer: virtual public G4OpenGLViewer {
50 
51  friend class G4OpenGLXViewerMessenger;
52  friend class G4OpenGLXmViewer;
53 
54 public:
55  G4OpenGLXViewer (G4OpenGLSceneHandler& scene);
56  virtual ~G4OpenGLXViewer ();
57  void SetView ();
58  void ShowView ();
59 #ifdef G4MULTITHREADED
60  void SwitchToVisSubThread();
61  void SwitchToMasterThread();
62 #endif
63  void DrawText(const G4Text&);
64 
65 protected:
66  void GetXConnection ();
67  void CreateGLXContext (XVisualInfo* vi);
68  virtual void CreateMainWindow ();
69  virtual void CreateFontLists ();
70 
71  static int snglBuf_RGBA[12];
72  static int dblBuf_RGBA[13];
73 
75 
76  XWindowAttributes xwa;
77  Display *dpy;
78  static XVisualInfo *vi_single_buffer;
79  static XVisualInfo *vi_double_buffer;
80  XVisualInfo *vi_immediate,
81  *vi_stored,
82  *vi;
83  Colormap cmap;
84  XSetWindowAttributes swa;
85  GLXDrawable win;
86  GLXContext cxMaster;
87 #ifdef G4MULTITHREADED
88  GLXContext cxVisSubThread;
89 #endif
90  XEvent event;
91  G4int *attributeList,
92  errorBase,
93  eventBase,
94  major,
95  minor;
96  XSizeHints *norm_hints;
97  XWMHints *wm_hints;
98  XClassHint *class_hints;
99  Pixmap icon_pixmap;
100  XSizeHints *size_hints;
101  Atom Xatom;
102  XTextProperty windowName,
103  iconName;
104  char charViewName [100];
105 
106 
107 private:
108  G4OpenGLXViewer (const G4OpenGLXViewer&);
109  G4OpenGLXViewer& operator = (const G4OpenGLXViewer&);
110  GLXContext tmp_cx;
111 };
112 
113 #endif
114 
115 #endif