source: trunk/source/visualization/OpenInventor/src/SoGL2PSAction.cc@ 927

Last change on this file since 927 was 927, checked in by garnier, 17 years ago

OI marche, mais en debug

  • Property svn:mime-type set to text/cpp
File size: 5.5 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#ifdef G4VIS_BUILD_OI_DRIVER
27
28/*----------------------------HEPVis----------------------------------------*/
29/* */
30/* Node: SoGL2PSAction */
31/* Author: Guy Barrand */
32/* */
33/*--------------------------------------------------------------------------*/
34
35#define G4DEBUG_VIS_OGL 1
36
37// this :
38#include <HEPVis/actions/SoGL2PSAction.h>
39
40// Inventor :
41#include <Inventor/elements/SoViewportRegionElement.h>
42#include <Inventor/errors/SoDebugError.h>
43
44#include "Geant4_gl2ps.h"
45
46#include <stdio.h>
47
48SO_ACTION_SOURCE(SoGL2PSAction)
49//////////////////////////////////////////////////////////////////////////////
50void SoGL2PSAction::initClass(
51)
52//////////////////////////////////////////////////////////////////////////////
53//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
54{
55#ifdef G4DEBUG_VIS_OGL
56 printf("SoGL2PSAction::initClass\n");
57#endif
58 SO_ACTION_INIT_CLASS(SoGL2PSAction,SoGLRenderAction);
59}
60//////////////////////////////////////////////////////////////////////////////
61SoGL2PSAction::SoGL2PSAction(
62 const SbViewportRegion& aViewPortRegion
63)
64:SoGLRenderAction(aViewPortRegion)
65,G4OpenGL2PSAction()
66//////////////////////////////////////////////////////////////////////////////
67//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
68{
69#ifdef G4DEBUG_VIS_OGL
70 printf("SoGL2PSAction::SoGL2PSAction\n");
71#endif
72 setFileName("out.ps");
73 SO_ACTION_CONSTRUCTOR(SoGL2PSAction);
74}
75
76bool SoGL2PSAction::enableFileWriting(
77)
78//////////////////////////////////////////////////////////////////////////////
79//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
80{
81 fFile = ::fopen(fFileName,"w");
82 if(!fFile) {
83 SoDebugError::post("SoGL2PSAction::enableFileWriting",
84 "Cannot open file %s",fFileName);
85 return false;
86 }
87#ifdef __COIN__
88#else //SGI
89 const SbViewportRegion& vpr = getViewportRegion();
90 SoViewportRegionElement::set(getState(),vpr);
91 gl2psBegin();
92#endif
93 return true;
94}
95
96//////////////////////////////////////////////////////////////////////////////
97void SoGL2PSAction::setViewport(
98)
99//////////////////////////////////////////////////////////////////////////////
100//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
101{
102#ifdef G4DEBUG_VIS_OGL
103 printf("SoGL2PSAction::setViewport\n");
104#endif
105 // Useful ? L.Garnier 02/2009
106
107#ifdef __COIN__
108#else //SGI
109 const SbViewportRegion& vpr = getViewportRegion();
110 SoViewportRegionElement::set(getState(),vpr);
111
112 const SbVec2s& win = vpr.getWindowSize();
113 fViewport[0] = 0;
114 fViewport[1] = 0;
115 fViewport[2] = win[0];
116 fViewport[3] = win[1];
117#endif
118}
119//////////////////////////////////////////////////////////////////////////////
120void SoGL2PSAction::beginTraversal(
121 SoNode* aNode
122)
123//////////////////////////////////////////////////////////////////////////////
124//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
125{
126#ifdef G4DEBUG_VIS_OGL
127 printf("SoGL2PSAction::beginTraversal\n");
128#endif
129 if(fFile) {
130#ifdef __COIN__
131 const SbViewportRegion& vpr = getViewportRegion();
132 SoViewportRegionElement::set(getState(),vpr);
133#ifdef G4DEBUG_VIS_OGL
134 printf("SoGL2PSAction::beginTraversal 1\n");
135#endif
136 G4gl2psBegin();
137#ifdef G4DEBUG_VIS_OGL
138 printf("SoGL2PSAction::beginTraversal 2\n");
139#endif
140 traverse(aNode);
141#ifdef G4DEBUG_VIS_OGL
142 printf("SoGL2PSAction::beginTraversal 3\n");
143#endif
144 gl2psEndPage();
145#ifdef G4DEBUG_VIS_OGL
146 printf("SoGL2PSAction::beginTraversal 4\n");
147#endif
148#else //SGI
149 SoGLRenderAction::beginTraversal(aNode);
150#endif
151 } else {
152 SoGLRenderAction::beginTraversal(aNode);
153 }
154#ifdef G4DEBUG_VIS_OGL
155 printf("SoGL2PSAction::beginTraversal 5\n");
156#endif
157}
158
159#endif
Note: See TracBrowser for help on using the repository browser.