Ignore:
Timestamp:
Apr 15, 2009, 12:00:49 PM (15 years ago)
Author:
garnier
Message:

passage de print OK

Location:
trunk/source/visualization/OpenGL/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/visualization/OpenGL/src/G4OpenGLImmediateXmViewer.cc

    r975 r980  
    3737#include "G4OpenGLImmediateXmViewer.hh"
    3838#include "G4OpenGLImmediateSceneHandler.hh"
     39#include "G4StateManager.hh"
    3940
    4041#include "G4ios.hh"
     
    116117  printf("G4OpenGLImmediateXmViewer::DrawView : need Kernel/Process/Finish\n");
    117118#endif
     119
     120
    118121  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
    119128  ProcessView ();
     129
     130  stateManager->SetNewState(oldState); 
    120131  FinishView ();
     132
    121133
    122134}
  • trunk/source/visualization/OpenGL/src/G4OpenGLStoredSceneHandler.cc

    r959 r980  
    196196    glPopMatrix();
    197197#ifdef G4DEBUG_VIS_OGL
    198     printf("G4OpenGLStoredSceneHandler::AddPrimitivePostamble glFlush\n");
     198    //    printf("G4OpenGLStoredSceneHandler::AddPrimitivePostamble glFlush\n");
    199199#endif
    200200    glFlush ();
     
    215215
    216216#ifdef G4DEBUG_VIS_OGL
    217   printf("G4OpenGLStoredSceneHandler::AddPrimitive\n");
     217  //  printf("G4OpenGLStoredSceneHandler::AddPrimitive\n");
    218218#endif
    219219  std::vector< G4Polymarker > poly;
     
    288288#endif 
    289289#ifdef G4DEBUG_VIS_OGL
    290   printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n");
     290  //  printf("G4OpenGLStoredSceneHandler::AddPrimitive new marker list\n");
    291291#endif
    292292  AddPrimitivePreamble(polymarker);
  • trunk/source/visualization/OpenGL/src/G4OpenGLViewer.cc

    r977 r980  
    438438  int size;
    439439
     440#ifdef G4DEBUG_VIS_OGL
     441  printf("G4OpenGLViewer::grabPixels\n");
     442#endif
    440443  if (inColor) {
    441444    format = GL_RGB;
     
    466469  glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
    467470
     471  glReadBuffer(GL_FRONT);
    468472  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
    469473
     
    485489#endif
    486490  if (fVectoredPs) {
     491#ifdef G4DEBUG_VIS_OGL
     492    printf("G4OpenGLViewer::printEPS Vectored\n");
     493#endif
    487494    res = printVectoredEPS();
    488495  } else {
     496#ifdef G4DEBUG_VIS_OGL
     497    printf("G4OpenGLViewer::printEPS NON Vectored\n");
     498#endif
    489499
    490500    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 {
    494506      res = printNonVectoredEPS();
    495     }
     507//     }
    496508  }
    497509  if (res == false) {
     
    631643  fWinSize_x = width;
    632644  fWinSize_y = height;
     645  glReadBuffer(GL_FRONT);
    633646  ResizeGLView();
    634647  if (fGL2PSAction->enableFileWriting()) {
  • trunk/source/visualization/OpenGL/src/G4OpenGLXViewer.cc

    r977 r980  
    9292
    9393void 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  }
    95108  G4OpenGLViewer::SetView (); 
    96109}
     
    429442    printf("G4OpenGLXViewer::print non Vectored\n");
    430443#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   
    433454
    434455
     
    448469
    449470// save context before
     471    XVisualInfo* tmp_vi = vi;
     472    GLXDrawable tmp_win = win;
    450473    tmp_cx = cx;
     474
    451475    XVisualInfo* pvi;
    452476    GLXContext pcx = create_GL_print_context(pvi);
     
    458482
    459483#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);
    461485#endif
    462486    cx=pcx;
     
    484508
    485509
    486     GLXDrawable tmp_win;
    487     tmp_win=win;
    488510    win=glxpmap;
    489511   
     
    544566    fWinSize_x = winX;
    545567#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);
    554585#endif
    555586    //    printf("Error 1:%d 2:%d\n",er1,er2);
    556587   
     588
    557589    // Free print context
    558590    XFreePixmap(dpy,pmap);
     
    666698
    667699
     700  glReadBuffer(GL_FRONT);
    668701  for (unsigned int i=0;i<height;i++) {
    669702    glReadPixels (0, i, (GLsizei)width, 1, format, GL_UNSIGNED_BYTE, (GLvoid*) lineBuffer);
Note: See TracChangeset for help on using the changeset viewer.