53 return CapturePostscript(viewer, format, filePath);
74 if (!filePath || !filePath[0]) {
76 filePath =
"viewer.eps";
78 filePath =
"viewer.pdf";
81 Info(
"TGLOutput::Postscript()",
"Start creating %s.", filePath);
82 std::cout <<
"Please wait.";
84 if (FILE *
output = fopen (filePath,
"w+b"))
91 gl2psFormat = GL2PS_EPS;
92 gl2psSort = GL2PS_SIMPLE_SORT;
95 gl2psFormat = GL2PS_EPS;
96 gl2psSort = GL2PS_BSP_SORT;
99 gl2psFormat = GL2PS_PDF;
100 gl2psSort = GL2PS_SIMPLE_SORT;
103 gl2psFormat = GL2PS_PDF;
104 gl2psSort = GL2PS_BSP_SORT;
110 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
113 while (state == GL2PS_OVERFLOW) {
114 buffsize += 1024*1024;
115 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
NULL,
116 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
117 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
118 GL_RGBA, 0,
NULL,0, 0, 0,
121 state = gl2psEndPage();
124 std::cout << std::endl;
128 Info(
"TGLOutput::Postscript",
"Finished creating %s.", filePath);
132 Error(
"TGLOutput::Postscript",
"Failed to create %s. ", filePath);
143 Info(
"TGLOutput::StartEmbeddedPS",
"PS output started ...");
148 Double_t xx[2] = {0.}, yy[2] = {0.};
149 xx[0] =
gPad->GetUxmin();
150 yy[0] =
gPad->GetUymin();
151 xx[1] =
gPad->GetUxmax();
152 yy[1] =
gPad->GetUymax();
156 glGetIntegerv(GL_VIEWPORT,vp);
195 Info(
"TGLOutput::CloseEmbeddedPS",
"PS output finished");
209 Error(
"TGLOutput::Capture",
"can not open file for embedding ps");
214 Int_t gl2psFormat = GL2PS_EPS;
215 Int_t gl2psSort = GL2PS_BSP_SORT;
216 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
220 while (state == GL2PS_OVERFLOW) {
221 buffsize += 1024*1024;
222 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
NULL,
223 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
224 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
225 GL_RGBA, 0,
NULL,0, 0, 0,
226 buffsize, output,
NULL);
228 state = gl2psEndPage();
232 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