48 return CapturePostscript(viewer, format, filePath);
69 if (!filePath || !filePath[0]) {
71 filePath =
"viewer.eps";
73 filePath =
"viewer.pdf";
76 Info(
"TGLOutput::Postscript()",
"Start creating %s.", filePath);
77 std::cout <<
"Please wait.";
79 if (FILE *
output = fopen (filePath,
"w+b"))
86 gl2psFormat = GL2PS_EPS;
87 gl2psSort = GL2PS_SIMPLE_SORT;
90 gl2psFormat = GL2PS_EPS;
91 gl2psSort = GL2PS_BSP_SORT;
94 gl2psFormat = GL2PS_PDF;
95 gl2psSort = GL2PS_SIMPLE_SORT;
98 gl2psFormat = GL2PS_PDF;
99 gl2psSort = GL2PS_BSP_SORT;
105 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
108 while (state == GL2PS_OVERFLOW) {
109 buffsize += 1024*1024;
110 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
NULL,
111 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
112 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
113 GL_RGBA, 0,
NULL,0, 0, 0,
116 state = gl2psEndPage();
119 std::cout << std::endl;
123 Info(
"TGLOutput::Postscript",
"Finished creating %s.", filePath);
127 Error(
"TGLOutput::Postscript",
"Failed to create %s. ", filePath);
138 Info(
"TGLOutput::StartEmbeddedPS",
"PS output started ...");
143 Double_t xx[2] = {0.}, yy[2] = {0.};
144 xx[0] =
gPad->GetUxmin();
145 yy[0] =
gPad->GetUymin();
146 xx[1] =
gPad->GetUxmax();
147 yy[1] =
gPad->GetUymax();
151 glGetIntegerv(GL_VIEWPORT,vp);
190 Info(
"TGLOutput::CloseEmbeddedPS",
"PS output finished");
204 Error(
"TGLOutput::Capture",
"can not open file for embedding ps");
209 Int_t gl2psFormat = GL2PS_EPS;
210 Int_t gl2psSort = GL2PS_BSP_SORT;
211 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
215 while (state == GL2PS_OVERFLOW) {
216 buffsize += 1024*1024;
217 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
NULL,
218 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
219 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
220 GL_RGBA, 0,
NULL,0, 0, 0,
221 buffsize, output,
NULL);
223 state = gl2psEndPage();
227 std::cout << std::endl;
virtual const char * GetName() const
Returns name of object.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void SetStream(std::ofstream *os)
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
virtual void WriteInteger(Int_t i, Bool_t space=kTRUE)
Write one Integer to the file.
static std::string format(double x, double y, int digits, int width)
static Bool_t CapturePostscript(TGLViewer &viewer, EFormat format, const char *filePath)
Capture viewer to postscript file.
Wrapper class for GL capture & output routines.
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
void Info(const char *location, const char *msgfmt,...)
virtual void * GetStream() const
void Error(const char *location, const char *msgfmt,...)
static void StartEmbeddedPS()
this function used by gl-in-pad
R__EXTERN TSystem * gSystem
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
Base GL viewer object - used by both standalone and embedded (in pad) GL.
static Bool_t Capture(TGLViewer &viewer, EFormat format, const char *filePath=0)
Capture viewer to file.
static void CloseEmbeddedPS()
this function used by gl-in-pad Restore the gVirtualPS output stream
virtual void DrawPS(Int_t n, Float_t *xw, Float_t *yw)=0
R__EXTERN TVirtualPS * gVirtualPS
static void output(int code)