source: trunk/source/visualization/OpenGL/include/G4OpenGLViewer.hh @ 975

Last change on this file since 975 was 975, checked in by garnier, 15 years ago

Improvments for print in pixmap. Not finish yet

  • Property svn:mime-type set to text/cpp
File size: 4.8 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: G4OpenGLViewer.hh,v 1.30 2009/04/08 16:55:44 lgarnier Exp $
28// GEANT4 tag $Name:  $
29//
30//
31// Andrew Walkden  27th March 1996
32// OpenGL viewer - opens window, hard copy, etc.
33
34#ifdef G4VIS_BUILD_OPENGL_DRIVER
35
36#ifndef G4OPENGLVIEWER_HH
37#define G4OPENGLVIEWER_HH
38
39#include "G4VViewer.hh"
40#include "G4OpenGL.hh"
41
42class G4OpenGLSceneHandler;
43class G4OpenGL2PSAction;
44
45// Base class for various OpenGLView classes.
46class G4OpenGLViewer: virtual public G4VViewer {
47
48  friend class G4OpenGLSceneHandler;
49  friend class G4OpenGLImmediateSceneHandler;
50  friend class G4OpenGLStoredSceneHandler;
51  friend class G4OpenGLFileSceneHandler;
52  friend class G4OpenGLViewerMessenger;
53
54public:
55  void ClearView  ();
56
57protected:
58  G4OpenGLViewer (G4OpenGLSceneHandler& scene);
59  virtual ~G4OpenGLViewer ();
60  void SetView    ();
61  void HaloingFirstPass ();
62  void HaloingSecondPass ();
63  void HLRFirstPass ();
64  void HLRSecondPass ();
65  void HLRThirdPass ();
66  void InitializeGLView ();
67  void ResizeGLView();
68  void Pick(GLdouble x, GLdouble y);
69  virtual void CreateFontLists () {}
70  void rotateScene (G4double dx, G4double dy,G4double delta);
71//////////////////////////////Vectored PostScript production functions///
72  void printEPS();
73  // print EPS file. Depending of fVectoredPs, it will print Vectored or not
74 
75  GLdouble getSceneNearWidth();
76  GLdouble getSceneFarWidth();
77  GLdouble getSceneDepth();
78  std::string                       fPrintFilename;
79  G4bool                            fPrintColour;
80  G4bool                            fVectoredPs;
81  G4int                             fPrintSizeX;
82  G4int                             fPrintSizeY;
83
84  G4OpenGLSceneHandler& fOpenGLSceneHandler;
85  G4Colour background;      //the OpenGL clear colour
86  unsigned int fWinSize_x, fWinSize_y;
87  // size of the OpenGL frame
88  G4bool
89    transparency_enabled,   //is alpha blending enabled?
90    antialiasing_enabled,   //is antialiasing enabled?
91    haloing_enabled;        //is haloing enabled for wireframe?
92  G4double fStartTime, fEndTime;  // Time range (e.g., for trajectory steps).
93  G4double fFadeFactor;  // 0: no fade; 1: maximum fade with time within range.
94  G4bool fDisplayHeadTime;  // Display head time (fEndTime) in 2D text.
95  G4double fDisplayHeadTimeX, fDisplayHeadTimeY;  // 2D screen coords.
96  G4double fDisplayHeadTimeSize;  // Screen size.
97  G4double fDisplayHeadTimeRed, fDisplayHeadTimeGreen, fDisplayHeadTimeBlue;
98  G4bool fDisplayLightFront;// Display light front at head time originating at
99  G4double fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ,
100    fDisplayLightFrontT;
101  G4double fDisplayLightFrontRed, fDisplayLightFrontGreen, fDisplayLightFrontBlue;
102  G4OpenGL2PSAction* fGL2PSAction;
103
104private :
105  G4float                           fPointSize;
106  bool printGl2PS();
107  GLubyte* grabPixels (int inColor,
108                       unsigned int width,
109                       unsigned int height);
110  bool printNonVectoredEPS ();
111  // print non vectored EPS files
112
113  bool printVectoredEPS();
114  // print vectored EPS files
115};
116
117typedef struct G4OpenGLViewerFeedback3Dcolor {
118  GLfloat x;
119  GLfloat y;
120  GLfloat z;
121  GLfloat red;
122  GLfloat green;
123  GLfloat blue;
124  GLfloat alpha;
125} Feedback3Dcolor;
126
127#endif
128
129#endif
Note: See TracBrowser for help on using the repository browser.