Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:48

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // 
0029 // Andrew Walkden  7th February 1997
0030 // G4OpenGLXViewer : Class to provide XWindows specific
0031 //                   functionality for OpenGL in GEANT4
0032 
0033 #ifndef G4OPENGLXVIEWER_HH
0034 #define G4OPENGLXVIEWER_HH
0035 
0036 #include "G4OpenGLViewer.hh"
0037 #include "globals.hh"
0038 
0039 #include <X11/Intrinsic.h>
0040 
0041 #include "G4OpenGL.hh"
0042 #include <GL/glx.h>
0043 
0044 class G4OpenGLSceneHandler;
0045 class G4Text;
0046 
0047 class G4OpenGLXViewer: virtual public G4OpenGLViewer {
0048 
0049   friend class G4OpenGLXViewerMessenger;
0050   friend class G4OpenGLXmViewer;
0051 
0052 public:
0053   G4OpenGLXViewer (G4OpenGLSceneHandler& scene);
0054   virtual ~G4OpenGLXViewer ();
0055   void SetView ();
0056   void ShowView ();
0057 #ifdef G4MULTITHREADED
0058   void SwitchToVisSubThread();
0059   void SwitchToMasterThread();
0060 #endif
0061   void DrawText(const G4Text&);
0062 
0063 protected:
0064   void GetXConnection ();
0065   void CreateGLXContext (XVisualInfo* vi);
0066   virtual void CreateMainWindow ();
0067   virtual void CreateFontLists ();
0068 
0069   static int snglBuf_RGBA[12];
0070   static int dblBuf_RGBA[13];
0071 
0072 //////////////////////////////Pixmap (screen dump) production functions/////
0073 
0074   XWindowAttributes                 xwa;
0075   Display                           *dpy;
0076   static XVisualInfo                *vi_single_buffer;
0077   static XVisualInfo                *vi_double_buffer;
0078   XVisualInfo                       *vi_immediate,
0079                                     *vi_stored,
0080                                     *vi;
0081   Colormap                          cmap;
0082   XSetWindowAttributes              swa;
0083   GLXDrawable                       win;
0084   GLXContext                        cxMaster;
0085 #ifdef G4MULTITHREADED
0086   GLXContext                        cxVisSubThread;
0087 #endif
0088   XEvent                            event;
0089   G4int                             *attributeList,
0090                                     errorBase,
0091                                     eventBase,
0092                                     major,
0093                                     minor;
0094   XSizeHints                        *norm_hints;
0095   XWMHints                          *wm_hints;
0096   XClassHint                        *class_hints;
0097   Pixmap                            icon_pixmap;
0098   XSizeHints                        *size_hints;
0099   Atom                              Xatom;
0100   XTextProperty                     windowName,
0101                                     iconName;
0102   char                              charViewName [100];
0103 
0104 
0105 private:
0106   G4OpenGLXViewer (const G4OpenGLXViewer&);
0107   G4OpenGLXViewer& operator = (const G4OpenGLXViewer&);
0108   GLXContext                        tmp_cx;
0109 };
0110 
0111 #endif