- Timestamp:
- Apr 12, 2010, 5:20:43 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r1238 r1242 234 234 // printf(" circle "); 235 235 #endif 236 #ifdef G4VIS_BUILD_OPTIMISE_3 237 std::vector <G4VMarker> circleV; 238 // FIXME, must check attribute before doing a list 239 #endif 236 240 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) { 237 241 G4Circle circle (polymarker); 242 // If not already drawn 238 243 circle.SetPosition (polymarker[iPoint]); 239 G4OpenGLSceneHandler::AddPrimitive (circle); 240 } 244 #ifdef G4VIS_BUILD_OPTIMISE_3 245 circleV.push_back(circle); 246 #endif 247 } 248 #ifdef G4VIS_BUILD_OPTIMISE_3 249 G4OpenGLSceneHandler::AddPrimitives (circleV); 250 #endif 241 251 } 242 252 break; … … 246 256 // printf(" square "); 247 257 #endif 258 #ifdef G4VIS_BUILD_OPTIMISE_3 259 std::vector <G4VMarker> squareV; 260 // FIXME, must check attribute before doing a list 261 #endif 248 262 for (size_t iPoint = 0; iPoint < polymarker.size (); iPoint++) { 249 263 G4Square square (polymarker); 250 264 square.SetPosition (polymarker[iPoint]); 251 G4OpenGLSceneHandler::AddPrimitive (square); 252 } 265 #ifdef G4VIS_BUILD_OPTIMISE_3 266 squareV.push_back(square); 267 #endif 268 } 269 #ifdef G4VIS_BUILD_OPTIMISE_3 270 G4OpenGLSceneHandler::AddPrimitives (squareV); 271 #endif 253 272 } 254 273 break; … … 319 338 } 320 339 340 void G4OpenGLSceneHandler::AddPrimitives (std::vector <G4VMarker> square) { 341 glDisable (GL_POINT_SMOOTH); 342 AddCircleSquares (square, G4OpenGLBitMapStore::square); 343 } 344 321 345 void G4OpenGLSceneHandler::AddCircleSquare 322 346 (const G4VMarker& marker, … … 398 422 glBegin (GL_POINTS); 399 423 glVertex3f(centre.x(),centre.y(),centre.z()); 424 glEnd(); 425 //Antialiasing 426 glEnable (GL_POINT_SMOOTH); 427 //Transparency 428 glEnable(GL_BLEND); 429 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 430 431 // L. GARNIER 1 March 2009 432 // Old method, we draw a bitmap instead of a GL_POINT. 433 // I remove it because it cost in term of computing performances 434 // and gl2ps can't draw bitmaps 435 436 // glRasterPos3d(centre.x(),centre.y(),centre.z()); 437 // const GLubyte* marker = 438 // G4OpenGLBitMapStore::GetBitMap(shape, size, filled); 439 // glPixelStorei(GL_UNPACK_ALIGNMENT, 1); 440 // glBitmap(GLsizei(size), GLsizei(size), size/2., size/2., 0., 0., marker); 441 } 442 } 443 444 void G4OpenGLSceneHandler::AddCircleSquares 445 (std::vector <G4VMarker> marker, 446 G4OpenGLBitMapStore::Shape shape) { 447 448 if (marker.size() == 0) { 449 return; 450 } 451 452 if (!fProcessingPolymarker) { // Polymarker has already loaded atts. 453 // Loads G4Atts for picking... 454 if (fpViewer->GetViewParameters().IsPicking()) { 455 G4AttHolder* holder = new G4AttHolder; 456 LoadAtts(marker[0], holder); 457 fPickMap[fPickName] = holder; 458 } 459 } 460 461 // Note: colour treated in sub-class. 462 463 if (fpViewer -> GetViewParameters ().IsMarkerNotHidden ()) { 464 #ifdef G4DEBUG_VIS_OGL 465 // printf("+"); 466 #endif 467 glDisable (GL_DEPTH_TEST); 468 } else { 469 #ifdef G4DEBUG_VIS_OGL 470 // printf("-"); 471 #endif 472 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS);} 473 474 glDisable (GL_LIGHTING); 475 476 // Get vis attributes - pick up defaults if none. 477 const G4VisAttributes* pVA = 478 fpViewer -> GetApplicableVisAttributes (marker[0].GetVisAttributes ()); 479 480 G4double lineWidth = GetLineWidth(pVA); 481 glLineWidth(lineWidth); 482 483 G4VMarker::FillStyle style = marker[0].GetFillStyle(); 484 485 G4bool filled = false; 486 static G4bool hashedWarned = false; 487 488 switch (style) { 489 case G4VMarker::noFill: 490 glPolygonMode (GL_FRONT_AND_BACK, GL_LINE); 491 filled = false; 492 break; 493 494 case G4VMarker::hashed: 495 if (!hashedWarned) { 496 G4cout << "Hashed fill style in G4OpenGLSceneHandler." 497 << "\n Not implemented. Using G4VMarker::filled." 498 << G4endl; 499 hashedWarned = true; 500 } 501 // Maybe use 502 //glPolygonStipple (fStippleMaskHashed); 503 // Drop through to filled... 504 505 case G4VMarker::filled: 506 glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); 507 filled = true; 508 break; 509 510 } 511 512 513 514 MarkerSizeType sizeType; 515 G4double size = GetMarkerSize(marker[0], sizeType); 516 517 // Draw... 518 if (sizeType == world) { // Size specified in world coordinates. 519 520 for (unsigned int a=0;a<marker.size();a++) { 521 G4Point3D centre = marker[a].GetPosition(); 522 // A few useful quantities... 523 DrawXYPolygon (shape, size, centre, pVA); 524 } 525 } else { // Size specified in screen (window) coordinates. 526 // A few useful quantities... 527 glPointSize (size); 528 glBegin (GL_POINTS); 529 for (unsigned int a=0;a<marker.size();a++) { 530 G4Point3D centre = marker[a].GetPosition(); 531 glVertex3f(centre.x(),centre.y(),centre.z()); 532 } 400 533 glEnd(); 401 534 //Antialiasing
Note: See TracChangeset
for help on using the changeset viewer.