[971] | 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.3 2009/03/19 11:59:35 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 | #include "Geant4_gl2ps.h" |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | G4OpenGL2PSAction::G4OpenGL2PSAction( |
---|
| 46 | ) |
---|
| 47 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 48 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 49 | { |
---|
| 50 | fFileName = ""; |
---|
| 51 | fFile = 0; |
---|
| 52 | fViewport[0] = 0; |
---|
| 53 | fViewport[1] = 0; |
---|
| 54 | fViewport[2] = 0; |
---|
| 55 | fViewport[3] = 0; |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 59 | void G4OpenGL2PSAction::setLineWidth( |
---|
| 60 | int width |
---|
| 61 | ) |
---|
| 62 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 63 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 64 | { |
---|
| 65 | gl2psLineWidth( width ); |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 69 | void G4OpenGL2PSAction::setPointSize( |
---|
| 70 | int size |
---|
| 71 | ) |
---|
| 72 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 73 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 74 | { |
---|
| 75 | gl2psPointSize( size ); |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 79 | void G4OpenGL2PSAction::setFileName( |
---|
| 80 | const char* aFileName |
---|
| 81 | ) |
---|
| 82 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 83 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 84 | { |
---|
| 85 | fFileName = aFileName; |
---|
| 86 | } |
---|
| 87 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 88 | bool G4OpenGL2PSAction::enableFileWriting( |
---|
| 89 | ) |
---|
| 90 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 91 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 92 | { |
---|
| 93 | fFile = ::fopen(fFileName,"w"); |
---|
| 94 | if(!fFile) { |
---|
| 95 | return false; |
---|
| 96 | } |
---|
| 97 | G4gl2psBegin(); |
---|
| 98 | return true; |
---|
| 99 | } |
---|
| 100 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 101 | void G4OpenGL2PSAction::disableFileWriting( |
---|
| 102 | ) |
---|
| 103 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 104 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 105 | { |
---|
| 106 | gl2psEndPage(); |
---|
| 107 | ::fclose(fFile); |
---|
| 108 | fFile = 0; |
---|
| 109 | } |
---|
| 110 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 111 | bool G4OpenGL2PSAction::fileWritingEnabled( |
---|
| 112 | ) const |
---|
| 113 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 114 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 115 | { |
---|
| 116 | return (fFile?true:false); |
---|
| 117 | } |
---|
| 118 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 119 | void G4OpenGL2PSAction::G4gl2psBegin( |
---|
| 120 | ) |
---|
| 121 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 122 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 123 | { |
---|
| 124 | if(!fFile) return; |
---|
| 125 | int options = GL2PS_OCCLUSION_CULL | |
---|
| 126 | GL2PS_BEST_ROOT | GL2PS_SILENT | GL2PS_DRAW_BACKGROUND; |
---|
| 127 | int sort = GL2PS_BSP_SORT; |
---|
| 128 | //int sort = GL2PS_SIMPLE_SORT; |
---|
| 129 | GLint buffsize = 0; |
---|
| 130 | buffsize += 1024*1024; |
---|
| 131 | |
---|
| 132 | glGetIntegerv(GL_VIEWPORT,fViewport); |
---|
| 133 | |
---|
| 134 | gl2psBeginPage("title","HEPVis::G4OpenGL2PSAction", |
---|
| 135 | fViewport, |
---|
| 136 | GL2PS_EPS, |
---|
| 137 | sort, |
---|
| 138 | options, |
---|
| 139 | GL_RGBA,0, NULL,0,0,0, |
---|
| 140 | buffsize, |
---|
| 141 | fFile,fFileName); |
---|
| 142 | } |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | |
---|
| 147 | #endif |
---|