Ignore:
Timestamp:
Mar 23, 2009, 6:25:48 PM (15 years ago)
Author:
garnier
Message:

Works for OGLSXm et non vector

File:
1 edited

Legend:

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

    r946 r948  
    4949#include "G4Point3D.hh"
    5050#include "G4Normal3D.hh"
     51#include "G4StateManager.hh"
    5152
    5253#include <X11/Xatom.h>
     
    484485    fGLXWin=glxpmap;
    485486   
     487    //
    486488    bool er1 = glXMakeCurrent (dpy,
    487489                               fGLXWin,  // pixmap win Id
     
    490492    glViewport (0, 0, fWinSize_x, fWinSize_y);
    491493   
     494    //    InitializeGLView ();
     495   
     496    // clear the buffers and window.
    492497    ClearView ();
    493     SetView ();
     498    SetView();
     499    //    FinishView ();
     500
    494501#ifdef G4DEBUG_VIS_OGL
    495502    printf("G4OpenGLXViewer::print Call DrawView context:%d old winGL:%d \n",cx,fGLXWin);
    496503#endif
    497     DrawView ();
     504
     505
     506
     507    // Need to force redraw for SXm mode
     508    NeedKernelVisit ();
     509
     510    // Need to change state to IDLE
     511    G4StateManager* stateManager = G4StateManager::GetStateManager();
     512    G4ApplicationState oldState = stateManager->GetCurrentState();
     513    stateManager->SetNewState(G4State_Idle); 
     514
     515   
     516
     517    DrawView (); // Will make current glX
     518
     519    // Restore state
     520     stateManager->SetNewState(oldState); 
     521
     522
     523
    498524   
    499525    std::string file = "G4OpenGL_XPixmap.eps";
     
    511537    printf("Error 1:%d 2:%d\n",er1,er2);
    512538   
     539    //    glXDestroyContext(pcx);
     540    //    glXDestroyGLXPixmap(glpixmap)
    513541  }
    514542
     
    548576
    549577 
     578  printf("------%d------\n",tmp_cx);
    550579  return glXCreateContext (dpy,
    551580                           pvi,
    552                            tmp_cx,
     581                           0,
    553582                           False);
    554583}
     
    596625  glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
    597626       
    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    }
     627  glXWaitGL (); //Wait for effects of all previous OpenGL commands to
     628  //                 //be propagated before progressing.
     629  glFlush ();
    607630
    608631//   printf("-----------\n-----------\n-----------\n-----------\n-----------\n%d %d %d\n",width, height,size);
Note: See TracChangeset for help on using the changeset viewer.