70 if (!filePath || !filePath[0]) {
72 filePath =
"viewer.eps";
74 filePath =
"viewer.pdf";
77 Info(
"TGLOutput::Postscript()",
"Start creating %s.", filePath);
78 std::cout <<
"Please wait.";
80 if (FILE *
output = fopen (filePath,
"w+b"))
87 gl2psFormat = GL2PS_EPS;
88 gl2psSort = GL2PS_SIMPLE_SORT;
91 gl2psFormat = GL2PS_EPS;
92 gl2psSort = GL2PS_BSP_SORT;
95 gl2psFormat = GL2PS_PDF;
96 gl2psSort = GL2PS_SIMPLE_SORT;
99 gl2psFormat = GL2PS_PDF;
100 gl2psSort = GL2PS_BSP_SORT;
106 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
109 while (state == GL2PS_OVERFLOW) {
110 buffsize += 1024*1024;
111 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT", NULL,
112 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
113 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
114 GL_RGBA, 0, NULL,0, 0, 0,
117 state = gl2psEndPage();
120 std::cout << std::endl;
124 Info(
"TGLOutput::Postscript",
"Finished creating %s.", filePath);
128 Error(
"TGLOutput::Postscript",
"Failed to create %s. ", filePath);
139 Info(
"TGLOutput::StartEmbeddedPS",
"PS output started ...");
144 Double_t xx[2] = {0.}, yy[2] = {0.};
145 xx[0] =
gPad->GetUxmin();
146 yy[0] =
gPad->GetUymin();
147 xx[1] =
gPad->GetUxmax();
148 yy[1] =
gPad->GetUymax();
152 glGetIntegerv(GL_VIEWPORT,vp);
191 Info(
"TGLOutput::CloseEmbeddedPS",
"PS output finished");
205 Error(
"TGLOutput::Capture",
"can not open file for embedding ps");
210 Int_t gl2psFormat = GL2PS_EPS;
211 Int_t gl2psSort = GL2PS_BSP_SORT;
212 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
216 while (state == GL2PS_OVERFLOW) {
217 buffsize += 1024*1024;
218 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT", NULL,
219 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
220 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
221 GL_RGBA, 0, NULL,0, 0, 0,
224 state = gl2psEndPage();
228 std::cout << std::endl;
void Info(const char *location, const char *msgfmt,...)
void Error(const char *location, const char *msgfmt,...)
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualPS * gVirtualPS
Wrapper class for GL capture & output routines.
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
static void StartEmbeddedPS()
this function used by gl-in-pad
static Bool_t CapturePostscript(TGLViewer &viewer, EFormat format, const char *filePath)
Capture viewer to postscript file.
Base GL viewer object - used by both standalone and embedded (in pad) GL.
Bool_t fIsPrinting
debug mode (forced rebuild + draw scene/frustum/interest boxes)
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.
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)
virtual void WriteInteger(Int_t i, Bool_t space=kTRUE)
Write one Integer to the file.
virtual void DrawPS(Int_t n, Float_t *xw, Float_t *yw)=0
virtual void PrintStr(const char *string="")
Output the string str in the output buffer.
virtual void * GetStream() const