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 bufsize = 0, state = GL2PS_OVERFLOW;
109 while (state == GL2PS_OVERFLOW) {
110 bufsize += 1024*1024;
111 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
nullptr,
112 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
113 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
114 GL_RGBA, 0,
nullptr,0, 0, 0,
115 bufsize, output,
nullptr);
117 state = gl2psEndPage();
120 std::cout << std::endl;
123 if (!
gSystem->AccessPathName(filePath)) {
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);
158 gVirtualPS->PrintStr(
" 4 1 roll exch sub 3 1 roll sub");
165 gVirtualPS->PrintStr(
" 4 1 roll div 3 1 roll exch div exch scale@");
172 std::ofstream *fs = (std::ofstream*)
gVirtualPS->GetStream();
183 std::ofstream *fs =
new std::ofstream(
gVirtualPS->GetName(),std::ios::app);
187 gVirtualPS->PrintStr(
"countdictstack exch sub { end } repeat@");
191 Info(
"TGLOutput::CloseEmbeddedPS",
"PS output finished");
201 FILE *output = fopen (
gVirtualPS->GetName(),
"a");
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 bufsize = 0, state = GL2PS_OVERFLOW;
216 while (state == GL2PS_OVERFLOW) {
217 bufsize += 1024*1024;
218 gl2psBeginPage (
"ROOT Scene Graph",
"ROOT",
nullptr,
219 gl2psFormat, gl2psSort, GL2PS_USE_CURRENT_VIEWPORT
220 | GL2PS_SILENT | GL2PS_BEST_ROOT | GL2PS_OCCLUSION_CULL | 0,
221 GL_RGBA, 0,
nullptr,0, 0, 0,
222 bufsize, output,
nullptr);
224 state = gl2psEndPage();
228 std::cout << std::endl;
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
externTVirtualPS * gVirtualPS
static Bool_t Capture(TGLViewer &viewer, EFormat format, const char *filePath=nullptr)
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.
void DoDraw(Bool_t swap_buffers=kTRUE)
Draw out the viewer.