71 if (!filePath || !filePath[0]) {
73 filePath =
"viewer.eps";
75 filePath =
"viewer.pdf";
78 Info(
"TGLOutput::Postscript()",
"Start creating %s.", filePath);
79 std::cout <<
"Please wait.";
81 if (FILE *
output = fopen (filePath,
"w+b"))
88 gl2psFormat = GL2PS_EPS;
89 gl2psSort = GL2PS_SIMPLE_SORT;
92 gl2psFormat = GL2PS_EPS;
93 gl2psSort = GL2PS_BSP_SORT;
96 gl2psFormat = GL2PS_PDF;
97 gl2psSort = GL2PS_SIMPLE_SORT;
100 gl2psFormat = GL2PS_PDF;
101 gl2psSort = GL2PS_BSP_SORT;
107 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
110 while (state == GL2PS_OVERFLOW) {
111 buffsize += 1024*1024;
112 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT", NULL,
113 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
114 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
115 GL_RGBA, 0, NULL,0, 0, 0,
118 state = gl2psEndPage();
121 std::cout << std::endl;
125 Info(
"TGLOutput::Postscript",
"Finished creating %s.", filePath);
129 Error(
"TGLOutput::Postscript",
"Failed to create %s. ", filePath);
140 Info(
"TGLOutput::StartEmbeddedPS",
"PS output started ...");
145 Double_t xx[2] = {0.}, yy[2] = {0.};
146 xx[0] =
gPad->GetUxmin();
147 yy[0] =
gPad->GetUymin();
148 xx[1] =
gPad->GetUxmax();
149 yy[1] =
gPad->GetUymax();
153 glGetIntegerv(GL_VIEWPORT,vp);
192 Info(
"TGLOutput::CloseEmbeddedPS",
"PS output finished");
206 Error(
"TGLOutput::Capture",
"can not open file for embedding ps");
211 Int_t gl2psFormat = GL2PS_EPS;
212 Int_t gl2psSort = GL2PS_BSP_SORT;
213 Int_t buffsize = 0, state = GL2PS_OVERFLOW;
217 while (state == GL2PS_OVERFLOW) {
218 buffsize += 1024*1024;
219 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT", NULL,
220 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
221 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
222 GL_RGBA, 0, NULL,0, 0, 0,
225 state = gl2psEndPage();
229 std::cout << std::endl;
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
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
static void output(int code)