Changeset 980
- Timestamp:
- Apr 15, 2009, 12:00:49 PM (15 years ago)
- Location:
- trunk/source/visualization/OpenGL/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc
r975 r980 37 37 #include "G4OpenGLImmediateXmViewer.hh" 38 38 #include "G4OpenGLImmediateSceneHandler.hh" 39 #include "G4StateManager.hh" 39 40 40 41 #include "G4ios.hh" … … 116 117 printf("G4OpenGLImmediateXmViewer::DrawView : need Kernel/Process/Finish\n"); 117 118 #endif 119 120 118 121 NeedKernelVisit (); // Always need to visit G4 kernel. 122 123 // Change G4 State in order to redraw everything even when state is not IDLE 124 G4StateManager* stateManager = G4StateManager::GetStateManager(); 125 G4ApplicationState oldState = stateManager->GetCurrentState(); 126 stateManager->SetNewState(G4State_Idle); 127 119 128 ProcessView (); 129 130 stateManager->SetNewState(oldState); 120 131 FinishView (); 132 121 133 122 134 } -
trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc
r959 r980 196 196 glPopMatrix(); 197 197 #ifdef G4DEBUG_VIS_OGL 198 printf("G4OpenGLStoredSceneHandler::AddPrimitivePostamble glFlush\n");198 // printf("G4OpenGLStoredSceneHandler::AddPrimitivePostamble glFlush\n"); 199 199 #endif 200 200 glFlush (); … … 215 215 216 216 #ifdef G4DEBUG_VIS_OGL 217 printf("G4OpenGLStoredSceneHandler::AddPrimitive\n");217 // printf("G4OpenGLStoredSceneHandler::AddPrimitive\n"); 218 218 #endif 219 219 std::vector< G4Polymarker > poly; … … 288 288 #endif 289 289 #ifdef G4DEBUG_VIS_OGL 290 printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n");290 // printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n"); 291 291 #endif 292 292 AddPrimitivePreamble(polymarker); -
trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc
r977 r980 438 438 int size; 439 439 440 #ifdef G4DEBUG_VIS_OGL 441 printf("G4OpenGLViewer::grabPixels\n"); 442 #endif 440 443 if (inColor) { 441 444 format = GL_RGB; … … 466 469 glPixelStorei (GL_UNPACK_ALIGNMENT, 1); 467 470 471 glReadBuffer(GL_FRONT); 468 472 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer); 469 473 … … 485 489 #endif 486 490 if (fVectoredPs) { 491 #ifdef G4DEBUG_VIS_OGL 492 printf("G4OpenGLViewer::printEPS Vectored\n"); 493 #endif 487 494 res = printVectoredEPS(); 488 495 } else { 496 #ifdef G4DEBUG_VIS_OGL 497 printf("G4OpenGLViewer::printEPS NON Vectored\n"); 498 #endif 489 499 490 500 G4OpenGLXViewer* pOGLXViewer = dynamic_cast<G4OpenGLXViewer*>(this); 491 if (pOGLXViewer) { 492 pOGLXViewer->printEPS(); 493 } else { 501 // if (pOGLXViewer) { 502 // res = printNonVectoredEPS(); 503 // pOGLXViewer->printEPS(); 504 // fPrintFilename = "G4OpenGLViewer_Print.eps"; 505 // } else { 494 506 res = printNonVectoredEPS(); 495 }507 // } 496 508 } 497 509 if (res == false) { … … 631 643 fWinSize_x = width; 632 644 fWinSize_y = height; 645 glReadBuffer(GL_FRONT); 633 646 ResizeGLView(); 634 647 if (fGL2PSAction->enableFileWriting()) { -
trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc
r977 r980 92 92 93 93 void G4OpenGLXViewer::SetView () { 94 glXMakeCurrent (dpy, win, cx); 94 #ifdef G4DEBUG_VIS_OGL 95 printf("G4OpenGLXViewer::SetView \n"); 96 #endif 97 Bool success = glXMakeCurrent (dpy, win, cx); 98 if (!success) { 99 fViewId = -1; // This flags an error. 100 G4cerr << "G4OpenGLViewer::G4OpenGLViewer failed to attach a GLX context." 101 << G4endl; 102 GLint error = GL_NO_ERROR; 103 while ((error = glGetError()) != GL_NO_ERROR) { 104 G4cout << "GL Error: " << gluErrorString(error) << G4endl; 105 } 106 return; 107 } 95 108 G4OpenGLViewer::SetView (); 96 109 } … … 429 442 printf("G4OpenGLXViewer::print non Vectored\n"); 430 443 #endif 431 // G4OpenGLViewer::printEPS(); 432 444 G4OpenGLViewer::printEPS(); 445 return; 446 447 448 449 std::string fileTst = "G4OpenGL_XPixmapTestWithoutPixmap.eps"; 450 generateEPSX (fileTst.c_str(), 451 fPrintColour, 452 fWinSize_x, fWinSize_y); 453 433 454 434 455 … … 448 469 449 470 // save context before 471 XVisualInfo* tmp_vi = vi; 472 GLXDrawable tmp_win = win; 450 473 tmp_cx = cx; 474 451 475 XVisualInfo* pvi; 452 476 GLXContext pcx = create_GL_print_context(pvi); … … 458 482 459 483 #ifdef G4DEBUG_VIS_OGL 460 printf("G4OpenGLXViewer::print Create pixmap Size :%d %d \n",fWinSize_x, fWinSize_y);484 printf("G4OpenGLXViewer::print Create pixmap Size :%d %d --- %d %d %d\n",fWinSize_x, fWinSize_y,vi,win,cx); 461 485 #endif 462 486 cx=pcx; … … 484 508 485 509 486 GLXDrawable tmp_win;487 tmp_win=win;488 510 win=glxpmap; 489 511 … … 544 566 fWinSize_x = winX; 545 567 #endif 546 win=tmp_win; 547 cx=tmp_cx; 548 549 // bool er2 = glXMakeCurrent (dpy, 550 // win, 551 // cx); 552 #ifdef G4DEBUG_VIS_OGL 553 printf("G4OpenGLXViewer::print Restored \n"); 568 vi = tmp_vi; 569 win = tmp_win; 570 cx = tmp_cx; 571 572 glXMakeCurrent (dpy, win, cx); 573 // XVisualInfo* pvi = glXChooseVisual (dpy, 574 // XDefaultScreen (dpy), 575 // snglBuf_RGBA); 576 577 // if (!pvi) { 578 // pvi = glXChooseVisual (dpy, 579 // XDefaultScreen (dpy), 580 // dblBuf_RGBA); 581 // } 582 583 #ifdef G4DEBUG_VIS_OGL 584 printf("G4OpenGLXViewer::print Restored %d %d %d\n",vi,win,cx); 554 585 #endif 555 586 // printf("Error 1:%d 2:%d\n",er1,er2); 556 587 588 557 589 // Free print context 558 590 XFreePixmap(dpy,pmap); … … 666 698 667 699 700 glReadBuffer(GL_FRONT); 668 701 for (unsigned int i=0;i<height;i++) { 669 702 glReadPixels (0, i, (GLsizei)width, 1, format, GL_UNSIGNED_BYTE, (GLvoid*) lineBuffer);
Note: See TracChangeset
for help on using the changeset viewer.