Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
G4OpenGL2PSAction.cc
Go to the documentation of this file.
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$
28//
29//
30
31#ifdef G4VIS_BUILD_OPENGL_DRIVER
32 #define G4VIS_BUILD_OPENGL_GL2PS
33#endif
34#ifdef G4VIS_BUILD_OI_DRIVER
35 #define G4VIS_BUILD_OPENGL_GL2PS
36#endif
37
38#ifdef G4VIS_BUILD_OPENGL_GL2PS
39
40#include "G4OpenGL2PSAction.hh"
41
42
44)
45//////////////////////////////////////////////////////////////////////////////
46//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
47{
48 fFileName = "";
49 fFile = 0;
50 fViewport[0] = 0;
51 fViewport[1] = 0;
52 fViewport[2] = 0;
53 fViewport[3] = 0;
54 fBufferSize = 1024;
55 fBufferSizeLimit = 8192;
57}
58
59//////////////////////////////////////////////////////////////////////////////
61)
62//////////////////////////////////////////////////////////////////////////////
63//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
64{
65 fBufferSize = 1024;
66 fBufferSizeLimit = 8192;
67}
68
69//////////////////////////////////////////////////////////////////////////////
71 int width
72)
73//////////////////////////////////////////////////////////////////////////////
74//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
75{
76 gl2psLineWidth( width );
77}
78
79//////////////////////////////////////////////////////////////////////////////
81 int size
82)
83//////////////////////////////////////////////////////////////////////////////
84//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
85{
86 gl2psPointSize( size );
87}
88
89//////////////////////////////////////////////////////////////////////////////
91int a
92,int b
93,int winSizeX
94,int winSizeY
95)
96//////////////////////////////////////////////////////////////////////////////
97//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
98{
99 fViewport[0] = a;
100 fViewport[1] = b;
101 fViewport[2] = winSizeX;
102 fViewport[3] = winSizeY;
103}
104
105//////////////////////////////////////////////////////////////////////////////
107 const char* aFileName
108)
109//////////////////////////////////////////////////////////////////////////////
110//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
111{
112 fFileName = aFileName;
113}
114//////////////////////////////////////////////////////////////////////////////
116)
117//////////////////////////////////////////////////////////////////////////////
118//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
119{
120 fFile = ::fopen(fFileName,"wb");
121 if(!fFile) {
122 return false;
123 }
124 return G4gl2psBegin();
125}
126//////////////////////////////////////////////////////////////////////////////
128)
129//////////////////////////////////////////////////////////////////////////////
130//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
131{
132 int state = gl2psEndPage();
133 ::fclose(fFile);
134 if (state == GL2PS_OVERFLOW) {
135 return false;
136 }
137 fFile = 0;
138 return true;
139}
140//////////////////////////////////////////////////////////////////////////////
142)
143//////////////////////////////////////////////////////////////////////////////
144//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
145{
146 // extend buffer size *2
147 if (fBufferSize*2 <= fBufferSizeLimit) {
149 return true;
150 }
151 return false;
152}
153//////////////////////////////////////////////////////////////////////////////
155) const
156//////////////////////////////////////////////////////////////////////////////
157//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
158{
159 return (fFile?true:false);
160}
161//////////////////////////////////////////////////////////////////////////////
163)
164//////////////////////////////////////////////////////////////////////////////
165//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
166{
167 if(!fFile) return false;
168 int options = GL2PS_OCCLUSION_CULL |
170// int options = GL2PS_OCCLUSION_CULL |
171// GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND;
172 int sort = GL2PS_BSP_SORT;
173 // int sort = GL2PS_SIMPLE_SORT;
174 GLint buffsize = 0;
175 buffsize += fBufferSize*fBufferSize;
176
177 glGetIntegerv(GL_VIEWPORT,fViewport);
178
179 GLint res = gl2psBeginPage("title","HEPVis::G4OpenGL2PSAction",
180 fViewport,
181 GL2PS_EPS,
182 sort,
183 options,
184 GL_RGBA,0, NULL,0,0,0,
185 buffsize,
187 if (res == GL2PS_ERROR) {
188 return false;
189 }
190 return true;
191
192}
193
194
195
196
197#endif
#define gl2psBeginPage
Definition: Geant4_gl2ps.h:34
#define gl2psLineWidth
Definition: Geant4_gl2ps.h:40
#define gl2psPointSize
Definition: Geant4_gl2ps.h:39
#define gl2psEndPage
Definition: Geant4_gl2ps.h:35
bool enableFileWriting()
void setLineWidth(int)
bool disableFileWriting()
const char * fFileName
bool fileWritingEnabled() const
void setViewport(int, int, int, int)
void setPointSize(int)
void setFileName(const char *)
void resetBufferSizeParameters()
#define GL2PS_ERROR
Definition: gl2ps.h:137
#define GL2PS_BSP_SORT
Definition: gl2ps.h:130
#define GL2PS_OCCLUSION_CULL
Definition: gl2ps.h:149
#define GL2PS_SILENT
Definition: gl2ps.h:147
#define GL2PS_OVERFLOW
Definition: gl2ps.h:139
#define GL2PS_BEST_ROOT
Definition: gl2ps.h:148
#define GL2PS_DRAW_BACKGROUND
Definition: gl2ps.h:145
#define GL2PS_EPS
Definition: gl2ps.h:120
#define GL2PS_USE_CURRENT_VIEWPORT
Definition: gl2ps.h:154
#define const
Definition: zconf.h:118