Changeset 929
- Timestamp:
- Feb 17, 2009, 6:25:18 PM (17 years ago)
- Location:
- trunk/source/visualization
- Files:
-
- 7 edited
-
OpenGL/src/G4OpenGLSceneHandler.cc (modified) (1 diff)
-
OpenGL/src/G4OpenGLStoredQtViewer.cc (modified) (1 diff)
-
OpenGL/src/G4OpenGLViewer.cc (modified) (2 diffs)
-
OpenInventor/include/HEPVis/actions/SoGL2PSAction.h (modified) (1 diff)
-
OpenInventor/src/G4OpenInventorSceneHandler.cc (modified) (1 diff)
-
OpenInventor/src/SoGL2PSAction.cc (modified) (2 diffs)
-
OpenInventor/src/SoMarkerSet.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r877 r929 367 367 368 368 // Draw... 369 if (sizeType == world) { // Size specified in world coordinates.370 369 /// if (sizeType == world) { // Size specified in world coordinates. 370 printf("G4OpenGLSceneHandler::AddCircleSquare world\n"); 371 371 DrawXYPolygon (shape, size, centre, pVA); 372 372 373 } else { // Size specified in screen (window) coordinates. 374 375 glRasterPos3d(centre.x(),centre.y(),centre.z()); 376 const GLubyte* marker = 377 G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 378 glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 379 glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 380 } 373 // } else { // Size specified in screen (window) coordinates. 374 // printf("G4OpenGLSceneHandler::AddCircleSquare bitmap\n"); 375 376 // glRasterPos3d(centre.x(),centre.y(),centre.z()); 377 // const GLubyte* marker = 378 // G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 379 // glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 380 // glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 381 // } 381 382 } 382 383 -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredQtViewer.cc
r911 r929 32 32 // G4OpenGLStoredViewer. 33 33 34 #define G4DEBUG_VIS_OGL 35 34 36 #ifdef G4VIS_BUILD_OPENGLQT_DRIVER 35 37 -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r925 r929 813 813 814 814 WritePostScript("AAAAAAAAAAAAAAA.ps"); 815 815 816 pixels = grabPixels (inColour, width, height); 816 817 … … 883 884 void G4OpenGLViewer::WritePostScript(const char *aFile) { 884 885 886 885 887 if (!fGL2PSAction) return; 888 889 // FIXME : TEST 890 G4VMarker defaultMarker = GetViewParameters().GetDefaultMarker(); 891 defaultMarker.SetWorldSize(defaultMarker.GetScreenSize()); 892 defaultMarker.SetWorldDiameter(defaultMarker.GetScreenDiameter()); 893 defaultMarker.SetWorldRadius(defaultMarker.GetScreenRadius()); 886 894 887 895 fGL2PSAction->setFileName("PostScriptViaGL2PS.ps"); 888 896 if (fGL2PSAction->enableFileWriting()) { 897 ShowView(); 898 ProcessView(); 889 899 DrawView(); 890 900 fGL2PSAction->disableFileWriting(); 891 901 } 902 // defaultMarker.SetScreenSize(defaultMarker.GetWorldSize()); 903 // defaultMarker.SetScreenDiameter(defaultMarker.GetWorldDiameter()); 904 // defaultMarker.SetScreenRadius(defaultMarker.GetWorldRadius()); 905 // FIXME : TEST 906 907 908 892 909 FILE *fFile = fopen(aFile,"w"); 893 910 if(!fFile) { -
trunk/source/visualization/OpenInventor/include/HEPVis/actions/SoGL2PSAction.h
r928 r929 46 46 bool enableFileWriting(); 47 47 void disableFileWriting(); 48 bool addBitmap(int,int,float=0,float=0,float=0,float=0); 48 49 protected: 49 50 virtual void beginTraversal(SoNode*); -
trunk/source/visualization/OpenInventor/src/G4OpenInventorSceneHandler.cc
r850 r929 230 230 void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker) 231 231 { 232 printf("G4OpenInventorSceneHandler::AddPrimitive------ \n"); 233 232 234 AddProperties(polymarker.GetVisAttributes()); // Transformation, colour, etc. 233 235 -
trunk/source/visualization/OpenInventor/src/SoGL2PSAction.cc
r928 r929 108 108 109 109 ////////////////////////////////////////////////////////////////////////////// 110 bool SoGL2PSAction::addBitmap( 111 int aWidth 112 ,int aHeight 113 ,float aXorig 114 ,float aYorig 115 ,float aXmove 116 ,float aYmove 117 ) 118 ///////////////////////////////////////////////////////////////////////////// 119 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 120 { 121 #ifdef G4DEBUG_VIS_OGL 122 printf("SoGL2PSAction::addBitmap\n"); 123 #endif 124 if(!fFile) return false; 125 GLboolean valid; 126 glGetBooleanv(GL_CURRENT_RASTER_POSITION_VALID,&valid); 127 if(!valid) return false; 128 float pos[4]; 129 glGetFloatv(GL_CURRENT_RASTER_POSITION,pos); 130 int xoff = -(int)(aXmove + aXorig); 131 int yoff = -(int)(aYmove + aYorig); 132 int x = (int)(pos[0] + xoff); 133 int y = (int)(pos[1] + yoff); 134 // Should clip against viewport area : 135 GLint vp[4]; 136 glGetIntegerv(GL_VIEWPORT,vp); 137 GLsizei w = aWidth; 138 GLsizei h = aHeight; 139 if(x+w>(vp[0]+vp[2])) w = vp[0]+vp[2]-x; 140 if(y+h>(vp[1]+vp[3])) h = vp[1]+vp[3]-y; 141 int s = 3 * w * h; 142 if(s<=0) return false; 143 float* image = (float*)::malloc(s * sizeof(float)); 144 if(!image) return false; 145 glReadPixels(x,y,w,h,GL_RGB,GL_FLOAT,image); 146 GLint status = gl2psDrawPixels(w,h,xoff,yoff,GL_RGB,GL_FLOAT,image); 147 ::free(image); 148 return (status!=GL2PS_SUCCESS ? false : true); 149 } 150 ////////////////////////////////////////////////////////////////////////////// 110 151 void SoGL2PSAction::beginTraversal( 111 152 SoNode* aNode … … 131 172 } 132 173 133 #endif 174 void SoGL2PSAction::DrawXYPolygon 175 (G4double size, 176 const G4Point3D& centre, 177 const G4VisAttributes* pApplicableVisAtts) 178 { 179 G4int nSides; 180 G4double startPhi; 181 nSides = GetNoOfSides(pApplicableVisAtts); 182 startPhi = 0.; 183 184 const G4Vector3D& viewpointDirection = 185 fpViewer -> GetViewParameters().GetViewpointDirection(); 186 const G4Vector3D& up = fpViewer->GetViewParameters().GetUpVector(); 187 const G4double dPhi = twopi / nSides; 188 const G4double radius = size / 2.; 189 G4Vector3D start = radius * (up.cross(viewpointDirection)).unit(); 190 G4double phi; 191 G4int i; 192 193 glBegin (GL_POLYGON); 194 for (i = 0, phi = startPhi; i < nSides; i++, phi += dPhi) { 195 G4Vector3D r = start; r.rotate(phi, viewpointDirection); 196 G4Vector3D p = centre + r; 197 glVertex3d (p.x(), p.y(), p.z()); 198 } 199 glEnd (); 200 } 201 202 #endif -
trunk/source/visualization/OpenInventor/src/SoMarkerSet.cc
r529 r929 657 657 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 658 658 { 659 printf("HEPVis_SoMarkerSet::GLRender\n"); 659 660 SoState* state = aAction->getState(); 660 661 … … 710 711 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 711 712 { 713 printf("drawMarker\n"); 712 714 GLsizei w = 0,h = 0; 713 715 GLfloat xorig = 0,yorig = 0;
Note:
See TracChangeset
for help on using the changeset viewer.
