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 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLStoredWin32Viewer.cc (Version 9.4.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4OpenGLStoredWin32Viewer.cc,v 1.22 2009-05-20 13:19:09 lgarnier Exp $
                                                   >>  28 // GEANT4 tag $Name: geant4-09-04-patch-01 $
 27 //                                                 29 //
 28 //                                                 30 // 
 29 // Class G4OpenGLStoredWin32Viewer : a class d     31 // Class G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
 30 //                             G4OpenGLStoredV     32 //                             G4OpenGLStoredViewer.
 31                                                    33 
 32 #include "G4OpenGLStoredWin32Viewer.hh"        <<  34 #ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
 33                                                    35 
 34 #include "G4OpenGLStoredSceneHandler.hh"       <<  36 #include "G4OpenGLStoredWin32Viewer.hh"
 35                                                    37 
 36 #include "G4ios.hh"                                38 #include "G4ios.hh"
 37                                                    39 
 38 G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32     40 G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer
 39 (G4OpenGLStoredSceneHandler& sceneHandler,         41 (G4OpenGLStoredSceneHandler& sceneHandler,
 40  const G4String&  name):                           42  const G4String&  name):
 41 G4OpenGLViewer (sceneHandler),                     43 G4OpenGLViewer (sceneHandler),
 42 G4OpenGLWin32Viewer (sceneHandler),                44 G4OpenGLWin32Viewer (sceneHandler),
 43 G4OpenGLStoredViewer (sceneHandler),               45 G4OpenGLStoredViewer (sceneHandler),
 44 G4VViewer (sceneHandler, sceneHandler.Incremen     46 G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
 45                                                    47 
 46   if (fViewId < 0) return;  // In case error i     48   if (fViewId < 0) return;  // In case error in base class instantiation.
 47 }                                                  49 }
 48                                                    50 
 49 void G4OpenGLStoredWin32Viewer::Initialise ()      51 void G4OpenGLStoredWin32Viewer::Initialise () {
 50                                                    52 
 51   //Check that G4OpenGLWin32Viewer got a doubl     53   //Check that G4OpenGLWin32Viewer got a double buffered colour visual
 52                                                    54 
 53   CreateGLWin32Context ();                         55   CreateGLWin32Context ();
 54   CreateMainWindow ();                             56   CreateMainWindow ();
 55   CreateFontLists ();                              57   CreateFontLists ();
 56                                                    58 
 57 // clear the buffers and window.                   59 // clear the buffers and window.
 58   ClearView ();                                    60   ClearView ();
 59   FinishView ();                                   61   FinishView ();
 60                                                    62 
 61   glDepthFunc (GL_LEQUAL);                         63   glDepthFunc (GL_LEQUAL);
 62   glDepthMask (GL_TRUE);                           64   glDepthMask (GL_TRUE);
 63 }                                                  65 }
 64                                                    66 
 65 void G4OpenGLStoredWin32Viewer::DrawView () {      67 void G4OpenGLStoredWin32Viewer::DrawView () {
 66                                                    68 
                                                   >>  69   //Make sure current viewer is attached and clean...
                                                   >>  70   //Win32 version needed
                                                   >>  71   //  glXMakeCurrent (dpy, win, cx);
 67   glViewport (0, 0, getWinWidth(), getWinHeigh     72   glViewport (0, 0, getWinWidth(), getWinHeight());
 68                                                    73 
 69   G4ViewParameters::DrawingStyle style = GetVi     74   G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
 70                                                    75 
 71   //See if things have changed from last time      76   //See if things have changed from last time and remake if necessary...
 72   // The fNeedKernelVisit flag might have been     77   // The fNeedKernelVisit flag might have been set by the user in
 73   // /vis/viewer/rebuild, but if not, make dec     78   // /vis/viewer/rebuild, but if not, make decision and set flag only
 74   // if necessary...                               79   // if necessary...
 75   if (!fNeedKernelVisit) KernelVisitDecision (     80   if (!fNeedKernelVisit) KernelVisitDecision ();
 76   fLastVP = fVP;                               << 
 77   G4bool kernelVisitWasNeeded = fNeedKernelVis     81   G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
 78   ProcessView ();                                  82   ProcessView ();
 79                                                    83 
 80   if(style!=G4ViewParameters::hlr &&               84   if(style!=G4ViewParameters::hlr &&
 81      haloing_enabled) {                            85      haloing_enabled) {
 82                                                    86 
 83     HaloingFirstPass ();                           87     HaloingFirstPass ();
 84     DrawDisplayLists ();                           88     DrawDisplayLists ();
 85     glFlush ();                                    89     glFlush ();
 86                                                    90 
 87     HaloingSecondPass ();                          91     HaloingSecondPass ();
 88                                                    92 
 89     DrawDisplayLists ();                           93     DrawDisplayLists ();
 90     FinishView ();                                 94     FinishView ();
 91                                                    95 
 92   } else {                                         96   } else {
 93                                                    97 
 94     // If kernel visit was needed, drawing and     98     // If kernel visit was needed, drawing and FinishView will already
 95     // have been done, so...                       99     // have been done, so...
 96     if (!kernelVisitWasNeeded) {                  100     if (!kernelVisitWasNeeded) {
 97       DrawDisplayLists ();                        101       DrawDisplayLists ();
 98       FinishView ();                              102       FinishView ();
 99     } else {                                      103     } else {
100     // However, union cutaways are implemented    104     // However, union cutaways are implemented in DrawDisplayLists, so make
101     // an extra pass...                           105     // an extra pass...
102       if (fVP.IsCutaway() &&                      106       if (fVP.IsCutaway() &&
103     fVP.GetCutawayMode() == G4ViewParameters::    107     fVP.GetCutawayMode() == G4ViewParameters::cutawayUnion) {
104   ClearView();                                    108   ClearView();
105   DrawDisplayLists ();                            109   DrawDisplayLists ();
106   FinishView ();                                  110   FinishView ();
107       } else { // ADD TO AVOID KernelVisit=1 a    111       } else { // ADD TO AVOID KernelVisit=1 and nothing to display
108         DrawDisplayLists ();                      112         DrawDisplayLists ();
109         FinishView ();                            113         FinishView ();
110       }                                           114       }
111     }                                             115     }
112   }                                               116   }
113 }                                                 117 }
114                                                   118 
115 //////////////////////////////////////////////    119 //////////////////////////////////////////////////////////////////////////////
116 void G4OpenGLStoredWin32Viewer::FinishView (      120 void G4OpenGLStoredWin32Viewer::FinishView (
117 )                                                 121 ) 
118 //////////////////////////////////////////////    122 //////////////////////////////////////////////////////////////////////////////
119 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!    123 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
120 {                                                 124 {
121   if(!fHDC) return;                               125   if(!fHDC) return;
122                                                   126 
123   glFlush ();                                     127   glFlush ();
124   GLint renderMode;                               128   GLint renderMode;
125   glGetIntegerv(GL_RENDER_MODE, &renderMode);     129   glGetIntegerv(GL_RENDER_MODE, &renderMode);
126   if (renderMode == GL_RENDER) ::SwapBuffers(f    130   if (renderMode == GL_RENDER) ::SwapBuffers(fHDC);
127                                                   131 
128   // Empty the Windows message queue :            132   // Empty the Windows message queue :
129   MSG event;                                      133   MSG event;
130   while ( ::PeekMessage(&event, NULL, 0, 0, PM    134   while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
131     ::TranslateMessage(&event);                   135     ::TranslateMessage(&event);
132     ::DispatchMessage (&event);                   136     ::DispatchMessage (&event);
133   }                                               137   }
134 }                                                 138 }
                                                   >> 139 
                                                   >> 140 #endif
135                                                   141