Changeset 929 for trunk/source/visualization/OpenInventor
- Timestamp:
- Feb 17, 2009, 6:25:18 PM (15 years ago)
- Location:
- trunk/source/visualization/OpenInventor
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
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.