source: trunk/source/visualization/OpenGL/include/G4OpenGLXViewer.hh @ 863

Last change on this file since 863 was 850, checked in by garnier, 16 years ago

geant4.8.2 beta

  • Property svn:mime-type set to text/cpp
File size: 4.4 KB
Line 
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// $Id: G4OpenGLXViewer.hh,v 1.28 2007/11/10 14:50:01 allison Exp $
28// GEANT4 tag $Name: HEAD $
29//
30//
31// Andrew Walkden  7th February 1997
32// G4OpenGLXViewer : Class to provide XWindows specific
33//                   functionality for OpenGL in GEANT4
34
35#ifdef G4VIS_BUILD_OPENGLX_DRIVER
36
37#ifndef G4OPENGLXVIEWER_HH
38#define G4OPENGLXVIEWER_HH
39
40#include "G4VViewer.hh"
41#include "G4OpenGLSceneHandler.hh"
42#include "globals.hh"
43
44#include <X11/Xlib.h>
45#include <X11/Intrinsic.h>
46#include <X11/Xmu/StdCmap.h>
47
48#include <GL/glx.h>
49
50class G4OpenGLSceneHandler;
51
52class G4OpenGLXViewer: virtual public G4OpenGLViewer {
53
54  friend class G4OpenGLXViewerMessenger;
55  friend class G4OpenGLXmViewer;
56
57public:
58  G4OpenGLXViewer (G4OpenGLSceneHandler& scene);
59  virtual ~G4OpenGLXViewer ();
60  void SetView ();
61  void ShowView ();
62
63protected:
64  void GetXConnection ();
65  void CreateGLXContext (XVisualInfo* vi);
66  virtual void CreateMainWindow ();
67  virtual void CreateFontLists ();
68  void print();
69
70  static int snglBuf_RGBA[12];
71  static int dblBuf_RGBA[13];
72
73//////////////////////////////Pixmap (screen dump) production functions/////
74  GLubyte* grabPixels (int inColor,
75                       unsigned int width,
76                       unsigned int height);
77  int generateEPS (char* filnam,
78                   int inColour,
79                   unsigned int width,
80                   unsigned int height);
81  GLXContext create_GL_print_context (XVisualInfo*& pvi);
82
83  XWindowAttributes                 xwa;
84  Display                           *dpy;
85  static XVisualInfo                *vi_single_buffer;
86  static XVisualInfo                *vi_double_buffer;
87  XVisualInfo                       *vi_immediate,
88                                    *vi_stored,
89                                    *vi;
90  Colormap                          cmap;
91  XSetWindowAttributes              swa;
92  GLXDrawable                       win;
93  GLXContext                        cx;
94  XEvent                            event;
95  G4int                             *attributeList,
96                                    errorBase,
97                                    eventBase,
98                                    major,
99                                    minor,
100                                    x_origin,
101                                    y_origin;
102  XSizeHints                        *norm_hints;
103  XWMHints                          *wm_hints;
104  XClassHint                        *class_hints;
105  Pixmap                            icon_pixmap;
106  XSizeHints                        *size_hints;
107  Atom                              Xatom;
108  XTextProperty                     windowName,
109                                    iconName;
110  char                              charViewName [100];
111
112private:
113  G4OpenGLXViewer (const G4OpenGLXViewer&);
114  G4OpenGLXViewer& operator = (const G4OpenGLXViewer&);
115};
116
117#endif
118
119#endif
Note: See TracBrowser for help on using the repository browser.