Changeset 918
- Timestamp:
- Feb 5, 2009, 5:41:43 PM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/include/G4OpenGLViewer.hh
r917 r918 77 77 unsigned int width, 78 78 unsigned int height); 79 void WritePostScript(const char *aFile); 79 80 void printBuffer(GLint, GLfloat*); 80 81 GLfloat* spewPrimitiveEPS (FILE*, GLfloat*); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r917 r918 48 48 #include "G4AttHolder.hh" 49 49 #include "G4AttCheck.hh" 50 51 #include "Geant4_gl2ps.h" 52 50 53 #include <sstream> 51 54 … … 409 412 if (file) { 410 413 spewWireframeEPS (file, returned, feedback_buffer, "rendereps"); 414 fclose(file); 411 415 } else { 412 416 printf("Could not open %s\n", fPrintFilename.c_str()); … … 804 808 int components, pos, i; 805 809 810 WritePostScript("1-PostScripTest.ps"); 811 806 812 pixels = grabPixels (inColour, width, height); 807 813 … … 869 875 fclose (fp); 870 876 return 0; 877 } 878 879 880 void G4OpenGLViewer::WritePostScript(const char *aFile) { 881 882 G4cout << "Produce " << aFile << "..." << G4endl; 883 884 // fGL2PSAction->enableFileWriting(); 885 FILE *fFile = fopen(aFile,"w"); 886 if(!fFile) { 887 G4cout << "G4OpenGLViewer::WritePostScript. Cannot open file " <<aFile << G4endl; 888 return; 889 } 890 891 // Get the viewport 892 GLint viewport[4]; 893 glGetIntegerv(GL_VIEWPORT, viewport); 894 895 896 897 int psformat; 898 // psformat = GL2PS_PDF; 899 psformat = GL2PS_PS; 900 // psformat = GL2PS_SVG; 901 // psformat = GL2PS_EPS; 902 903 // int old_bg_gradient = CTX.bg_gradient; 904 // if(!CTX.print.eps_background) CTX.bg_gradient = 0; 905 906 // PixelBuffer buffer(width, height, GL_RGB, GL_FLOAT); 907 908 // if(CTX.print.eps_quality == 0) 909 // buffer.Fill(CTX.batch); 910 911 int pssort = GL2PS_SIMPLE_SORT; 912 // int pssort = 913 // (CTX.print.eps_quality == 3) ? GL2PS_NO_SORT : 914 // (CTX.print.eps_quality == 2) ? GL2PS_BSP_SORT : 915 // GL2PS_SIMPLE_SORT; 916 int psoptions = GL2PS_SIMPLE_LINE_OFFSET | GL2PS_DRAW_BACKGROUND; 917 // GL2PS_SIMPLE_LINE_OFFSET | GL2PS_SILENT | 918 // (CTX.print.eps_occlusion_culling ? GL2PS_OCCLUSION_CULL : 0) | 919 // (CTX.print.eps_best_root ? GL2PS_BEST_ROOT : 0) | 920 // (CTX.print.eps_background ? GL2PS_DRAW_BACKGROUND : 0) | 921 // (CTX.print.eps_compress ? GL2PS_COMPRESS : 0) | 922 // (CTX.print.eps_ps3shading ? 0 : GL2PS_NO_PS3_SHADING); 923 924 GLint buffsize = 0; 925 int res = GL2PS_OVERFLOW; 926 while(res == GL2PS_OVERFLOW) { 927 buffsize += 2048 * 2048; 928 gl2psBeginPage("MyTitle", "Geant4", viewport, 929 psformat, pssort, psoptions, GL_RGBA, 0, NULL, 930 15, 20, 10, buffsize, fFile, aFile); 931 DrawView(); 932 res = gl2psEndPage(); 933 } 934 935 // CTX.bg_gradient = old_bg_gradient; 936 fclose(fFile); 937 871 938 } 872 939
Note: See TracChangeset
for help on using the changeset viewer.