source: trunk/source/visualization/externals/gl2ps/src/G4OpenGL2PSAction.cc@ 1228

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

update geant4.9.3 tag

File size: 5.0 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: G4OpenGL2PSAction.cc,v 1.4 2009/04/29 09:37:55 lgarnier Exp $
28// GEANT4 tag $Name: $
29//
30//
31
32#ifdef G4VIS_BUILD_OPENGL_DRIVER
33 #define G4VIS_BUILD_OPENGL_GL2PS
34#endif
35#ifdef G4VIS_BUILD_OI_DRIVER
36 #define G4VIS_BUILD_OPENGL_GL2PS
37#endif
38
39#ifdef G4VIS_BUILD_OPENGL_GL2PS
40
41#include "G4OpenGL2PSAction.hh"
42
43
44G4OpenGL2PSAction::G4OpenGL2PSAction(
45)
46//////////////////////////////////////////////////////////////////////////////
47//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
48{
49 fFileName = "";
50 fFile = 0;
51 fViewport[0] = 0;
52 fViewport[1] = 0;
53 fViewport[2] = 0;
54 fViewport[3] = 0;
55}
56
57//////////////////////////////////////////////////////////////////////////////
58void G4OpenGL2PSAction::setLineWidth(
59 int width
60)
61//////////////////////////////////////////////////////////////////////////////
62//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
63{
64 gl2psLineWidth( width );
65}
66
67//////////////////////////////////////////////////////////////////////////////
68void G4OpenGL2PSAction::setPointSize(
69 int size
70)
71//////////////////////////////////////////////////////////////////////////////
72//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
73{
74 gl2psPointSize( size );
75}
76
77//////////////////////////////////////////////////////////////////////////////
78void G4OpenGL2PSAction::setFileName(
79 const char* aFileName
80)
81//////////////////////////////////////////////////////////////////////////////
82//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
83{
84 fFileName = aFileName;
85}
86//////////////////////////////////////////////////////////////////////////////
87bool G4OpenGL2PSAction::enableFileWriting(
88)
89//////////////////////////////////////////////////////////////////////////////
90//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
91{
92 fFile = ::fopen(fFileName,"w");
93 if(!fFile) {
94 return false;
95 }
96 G4gl2psBegin();
97 return true;
98}
99//////////////////////////////////////////////////////////////////////////////
100void G4OpenGL2PSAction::disableFileWriting(
101)
102//////////////////////////////////////////////////////////////////////////////
103//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
104{
105 gl2psEndPage();
106 ::fclose(fFile);
107 fFile = 0;
108}
109//////////////////////////////////////////////////////////////////////////////
110bool G4OpenGL2PSAction::fileWritingEnabled(
111) const
112//////////////////////////////////////////////////////////////////////////////
113//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
114{
115 return (fFile?true:false);
116}
117//////////////////////////////////////////////////////////////////////////////
118void G4OpenGL2PSAction::G4gl2psBegin(
119)
120//////////////////////////////////////////////////////////////////////////////
121//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
122{
123 if(!fFile) return;
124 int options = GL2PS_OCCLUSION_CULL |
125 GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND;
126 int sort = GL2PS_BSP_SORT;
127 //int sort = GL2PS_SIMPLE_SORT;
128 GLint buffsize = 0;
129 buffsize += 1024*1024;
130
131 glGetIntegerv(GL_VIEWPORT,fViewport);
132
133 gl2psBeginPage("title","HEPVis::G4OpenGL2PSAction",
134 fViewport,
135 GL2PS_EPS,
136 sort,
137 options,
138 GL_RGBA,0, NULL,0,0,0,
139 buffsize,
140 fFile,fFileName);
141}
142
143
144
145
146#endif
Note: See TracBrowser for help on using the repository browser.