Changeset 946 for trunk/source/visualization/OpenGL/src
- Timestamp:
- Mar 19, 2009, 11:04:17 AM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL/src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLSceneHandler.cc
r935 r946 372 372 373 373 } else { // Size specified in screen (window) coordinates. 374 glPointSize (size );374 glPointSize (size*centre.x()); 375 375 glBegin (GL_POINTS); 376 376 glVertex3f(centre.x(),centre.y(),centre.z()); -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r945 r946 281 281 } 282 282 #endif 283 printf("G4OpenGLStoredSceneHandler::AddPrimitive Cree une nouvelle liste de markers\n");283 printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n"); 284 284 AddPrimitivePreamble(polymarker); 285 285 G4OpenGLSceneHandler::AddPrimitive(polymarker); -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredViewer.cc
r945 r946 133 133 fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion; 134 134 size_t nPasses = cutawayUnion? cutaways.size(): 1; 135 #ifdef G4DEBUG_VIS_OGL 136 printf("G4OpenGLStoredViewer::DrawDisplayLists %d",nPasses); 137 #endif 135 138 for (size_t i = 0; i < nPasses; ++i) { 136 139 #ifdef G4DEBUG_VIS_OGL 137 printf(" G4OpenGLStoredViewer::DrawDisplayLists cutaway %d/%d\n",i,nPasses);140 printf("+"); 138 141 #endif 139 142 … … 153 156 for (size_t i = 0; i < fG4OpenGLStoredSceneHandler.fTOList.size(); ++i) { 154 157 #ifdef G4DEBUG_VIS_OGL 155 printf(" +");158 printf("-"); 156 159 #endif 157 160 G4OpenGLStoredSceneHandler::TO& to = … … 175 178 if (cutawayUnion) glDisable (GL_CLIP_PLANE2); 176 179 } 180 #ifdef G4DEBUG_VIS_OGL 181 printf("\n"); 182 #endif 177 183 178 184 // Display time at "head" of time range, which is fEndTime... -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredXViewer.cc
r945 r946 77 77 void G4OpenGLStoredXViewer::DrawView () { 78 78 79 printf("G4OpenGLStoredXViewer::DrawView\n"); 79 80 //Make sure current viewer is attached and clean... 80 81 glXMakeCurrent (dpy, fGLXWin, cx); … … 107 108 // have been done, so... 108 109 if (!kernelVisitWasNeeded) { 110 printf("G4OpenGLStoredXViewer::DrawView NO need kernel visit\n"); 109 111 DrawDisplayLists (); 110 112 FinishView (); 111 113 } else { 114 printf("G4OpenGLStoredXViewer::DrawView NEED kernel visit\n"); 112 115 // However, union cutaways are implemented in DrawDisplayLists, so make 113 116 // an extra pass... -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredXmViewer.cc
r945 r946 83 83 void G4OpenGLStoredXmViewer::DrawView () { 84 84 #ifdef G4DEBUG_VIS_OGL 85 printf("G4OpenGLStoredXmViewer::DrawView VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV\n");85 printf("G4OpenGLStoredXmViewer::DrawView context:%d old winGL:%d \n",cx,fGLXWin); 86 86 #endif 87 87 … … 116 116 if (!kernelVisitWasNeeded) { 117 117 #ifdef G4DEBUG_VIS_OGL 118 printf(" **************************G4OpenGLStoredXmViewer::ComputeView Don't need kernel Visit \n");118 printf("G4OpenGLStoredXmViewer::ComputeView Don't need kernel Visit \n"); 119 119 #endif 120 120 DrawDisplayLists (); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r945 r946 587 587 588 588 // FIXME : How to get the point size.... ? 589 fGL2PSAction->setLineWidth(1);589 // fGL2PSAction->setLineWidth(1); 590 590 // FIXME : How to get the line width.... ? 591 fGL2PSAction->setPointSize(30);591 // fGL2PSAction->setPointSize(30); 592 592 593 593 DrawView (); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewerMessenger.cc
r941 r946 177 177 fpCommandFade->SetDefaultValue(0.); 178 178 179 179 180 fpCommandPrintMode = new G4UIcmdWithAString 180 181 ("/vis/ogl/set/printMode",this); … … 228 229 (G4UIcommand* command, G4String newValue) 229 230 { 231 230 232 G4VisManager* pVisManager = G4VisManager::GetInstance(); 233 231 234 232 235 G4VViewer* pVViewer = pVisManager->GetCurrentViewer(); … … 250 253 } 251 254 252 if (command == fpCommandPrintEPS) 255 if (command == fpCommandPrintEPS) 253 256 { 254 257 // Keep copy of fPrintFilename to preserve Xm behaviour... … … 261 264 pOGLViewer->fPrintFilename = std::string(oss.str().c_str()); 262 265 // Print eps file... 266 printf("G4OpenGLViewerMessenger : Call printEPS \n"); 263 267 pOGLViewer->printEPS(); 264 268 // Restore fPrintFilename for Xm... 265 269 pOGLViewer->fPrintFilename = tmp_string; 266 270 return; 271 } 272 273 if (command == fpCommandPrintMode) 274 { 275 if (newValue == "vectored") pOGLViewer->fVectoredPs = true; 276 if (newValue == "pixmap") pOGLViewer->fVectoredPs = false; 267 277 } 268 278 … … 343 353 } 344 354 345 if (command == fpCommandPrintMode)346 {347 if (newValue == "vectored") pViewer->fVectoredPs = true;348 if (newValue == "pixmap") pViewer->fVectoredPs = false;349 }350 351 355 if (command == fpCommandStartTime) 352 356 { -
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r945 r946 410 410 } 411 411 412 void G4OpenGLXViewer::print() { 413 412 void G4OpenGLXViewer::printEPS() { 413 414 printf("G4OpenGLXViewer::print \n"); 415 414 416 //using namespace std; 415 417 //cout << "print_col_callback requested with file name: " << fPrintFilename << G4endl; … … 419 421 printf("G4OpenGLXViewer::print Vectored\n"); 420 422 #endif 421 printEPS();423 G4OpenGLViewer::printEPS(); 422 424 } else { 423 425 #ifdef G4DEBUG_VIS_OGL 424 426 printf("G4OpenGLXViewer::print non Vectored\n"); 425 427 #endif 426 // printEPS (); 427 // return; 428 428 // G4StateManager* stateManager = G4StateManager::GetStateManager(); 429 // G4ApplicationState oldState = stateManager->GetCurrentState(); 430 // stateManager->SetNewState(G4State_Idle); 431 432 // printEPS (); 433 434 // stateManager->SetNewState(oldState); 435 436 // // fPrintFilename = fPrintFilename+"-Gl2ps.ps"; 437 // return; 438 439 // save context before 440 tmp_cx = cx; 429 441 XVisualInfo* pvi; 430 442 GLXContext pcx = create_GL_print_context(pvi); 431 443 // cmap = XCreateColormap (dpy, 444 // XRootWindow(dpy, pvi -> screen), 445 // pvi -> visual, 446 // AllocNone); 447 // if (!cmap) { 448 // fViewId = -1; // This flags an error. 449 // G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to allocate a Colormap." 450 // << G4endl; 451 // return; 452 // } 453 // swa.colormap = cmap; 432 454 if (!pcx) { 433 455 G4cout << "Unable to create print context." << G4endl; … … 435 457 } 436 458 437 GLXContext tmp_cx; 438 tmp_cx = cx; 459 #ifdef G4DEBUG_VIS_OGL 460 printf("G4OpenGLXViewer::print Create pixmap old context:%d new context %d old winGL:%d \n",cx,pcx,fGLXWin); 461 #endif 439 462 cx=pcx; 440 463 … … 444 467 pvi->depth); 445 468 469 470 if (!pmap) { 471 G4cout << "Unable to create pixmap." << G4endl; 472 return; 473 } 446 474 GLXPixmap glxpmap = glXCreateGLXPixmap (dpy, 447 475 pvi, 448 476 pmap); 449 477 478 if (!glxpmap) { 479 G4cout << "Unable to create glx pixmap." << G4endl; 480 return; 481 } 450 482 GLXDrawable tmp_win; 451 483 tmp_win=fGLXWin; 452 484 fGLXWin=glxpmap; 453 485 454 // This won't work because fGLXWin is not known in G4OpenGLViewer... 455 456 glXMakeCurrent (dpy, 457 fGLXWin, 458 cx); 486 bool er1 = glXMakeCurrent (dpy, 487 fGLXWin, // pixmap win Id 488 cx); // pixmap context Id 459 489 460 490 glViewport (0, 0, fWinSize_x, fWinSize_y); … … 462 492 ClearView (); 463 493 SetView (); 494 #ifdef G4DEBUG_VIS_OGL 495 printf("G4OpenGLXViewer::print Call DrawView context:%d old winGL:%d \n",cx,fGLXWin); 496 #endif 464 497 DrawView (); 465 498 … … 472 505 cx=tmp_cx; 473 506 474 glXMakeCurrent (dpy, 475 fGLXWin, 476 cx); 507 bool er2 = glXMakeCurrent (dpy, 508 fGLXWin, 509 cx); 510 printf("G4OpenGLXViewer::print Restored context:%d old winGL:%d \n",cx,fGLXWin); 511 printf("Error 1:%d 2:%d\n",er1,er2); 477 512 478 513 } … … 493 528 } 494 529 530 // GLXFBConfig *fbc; 531 // XVisualInfo *vi; 532 // Colormap cmap; 533 // XSetWindowAttributes swa; 534 // Window win; 535 // GLXContext cx; 536 // GLXWindow gwin; 537 // XEvent event; 538 // int nelements; 539 540 // /* Find a FBConfig that uses RGBA. Note that no attribute list is */ 541 // /* needed since GLX_RGBA_BIT is a default attribute. */ 542 // fbc = glXChooseFBConfig(dpy,XRootWindow (dpy, pvi->screen), 0, &nelements); 543 // vi = glXGetVisualFromFBConfig(dpy, fbc[0]); 544 545 // /* Create a GLX context using the first FBConfig in the list. */ 546 // return glXCreateNewContext(dpy, fbc[0], GLX_RGBA_TYPE, 0, GL_FALSE); 547 548 549 495 550 return glXCreateContext (dpy, 496 551 pvi, 497 NULL,552 tmp_cx, 498 553 False); 499 554 } … … 501 556 502 557 GLubyte* G4OpenGLXViewer::grabPixelsX (int inColor, unsigned int width, unsigned int height) { 558 #ifdef G4DEBUG_VIS_OGL 559 printf("G4OpenGLXViewer::grabPixelsX\n"); 560 #endif 503 561 504 562 GLubyte* buffer; … … 538 596 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer); 539 597 598 // glXWaitGL (); //Wait for effects of all previous OpenGL commands to 599 // //be propagated before progressing. 600 // glFlush (); 601 for (int i = 0; i<size; i++) { 602 if (buffer[i] != 0) 603 printf("%d",buffer[i]); 604 // else 605 // printf("."); 606 } 607 608 // printf("-----------\n-----------\n-----------\n-----------\n-----------\n%d %d %d\n",width, height,size); 609 // char * pixels = new char [3 * width * height]; 610 // glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, GL_DEPTH_COMPONENT, GL_FLOAT, pixels); 611 612 // for (int i = 0; i<size; i++) { 613 // if (pixels[i] != 0) 614 // printf("%d ",pixels[i]); 615 // else 616 // printf(" "); 617 // } 618 619 // printf("-----------\n-----------\n-----------\n-----------\n-----------\n"); 620 540 621 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes); 541 622 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst); … … 546 627 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment); 547 628 629 548 630 return buffer; 549 631 } … … 559 641 int components, pos, i; 560 642 643 #ifdef G4DEBUG_VIS_OGL 644 printf("G4OpenGLXViewer::generateEPSX\n"); 645 #endif 646 561 647 pixels = grabPixelsX (inColour, width, height); 648 #ifdef G4DEBUG_VIS_OGL 649 printf("--\n--\n--\n"); 650 #endif 562 651 563 652 if (pixels == NULL) -
trunk/source/visualization/OpenGL/src/G4OpenGLXmWindowHandlingCallbacks.cc
r931 r946 74 74 { 75 75 G4OpenGLXViewer* pView = (G4OpenGLXmViewer*) clientData; 76 pView->print ();76 pView->printEPS(); 77 77 } 78 78
Note: See TracChangeset
for help on using the changeset viewer.