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

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

before tag

File size: 5.6 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.6 2010/11/03 16:40:34 lgarnier Exp $
28// GEANT4 tag $Name: visexternal-V09-03-01 $
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::setViewport(
79int a
80,int b
81,int winSizeX
82,int winSizeY
83)
84//////////////////////////////////////////////////////////////////////////////
85//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
86{
87 fViewport[0] = a;
88 fViewport[1] = b;
89 fViewport[2] = winSizeX;
90 fViewport[3] = winSizeY;
91}
92
93//////////////////////////////////////////////////////////////////////////////
94void G4OpenGL2PSAction::setFileName(
95 const char* aFileName
96)
97//////////////////////////////////////////////////////////////////////////////
98//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
99{
100 fFileName = aFileName;
101}
102//////////////////////////////////////////////////////////////////////////////
103bool G4OpenGL2PSAction::enableFileWriting(
104)
105//////////////////////////////////////////////////////////////////////////////
106//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
107{
108 fFile = ::fopen(fFileName,"w");
109 if(!fFile) {
110 return false;
111 }
112 G4gl2psBegin();
113 return true;
114}
115//////////////////////////////////////////////////////////////////////////////
116void G4OpenGL2PSAction::disableFileWriting(
117)
118//////////////////////////////////////////////////////////////////////////////
119//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
120{
121 gl2psEndPage();
122 ::fclose(fFile);
123 fFile = 0;
124}
125//////////////////////////////////////////////////////////////////////////////
126bool G4OpenGL2PSAction::fileWritingEnabled(
127) const
128//////////////////////////////////////////////////////////////////////////////
129//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
130{
131 return (fFile?true:false);
132}
133//////////////////////////////////////////////////////////////////////////////
134void G4OpenGL2PSAction::G4gl2psBegin(
135)
136//////////////////////////////////////////////////////////////////////////////
137//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
138{
139 if(!fFile) return;
140 int options = GL2PS_OCCLUSION_CULL |
141 GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND | GL2PS_USE_CURRENT_VIEWPORT;
142// int options = GL2PS_OCCLUSION_CULL |
143// GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND;
144 int sort = GL2PS_BSP_SORT;
145 //int sort = GL2PS_SIMPLE_SORT;
146 GLint buffsize = 0;
147 buffsize += 1024*1024;
148
149 glGetIntegerv(GL_VIEWPORT,fViewport);
150
151 gl2psBeginPage("title","HEPVis::G4OpenGL2PSAction",
152 fViewport,
153 GL2PS_EPS,
154 sort,
155 options,
156 GL_RGBA,0, NULL,0,0,0,
157 buffsize,
158 fFile,fFileName);
159}
160
161
162
163
164#endif
Note: See TracBrowser for help on using the repository browser.