Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer << 3 // * DISCLAIMER * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th << 5 // * The following disclaimer summarizes all the specific disclaimers * 6 // * the Geant4 Collaboration. It is provided << 6 // * of contributors to this software. The specific disclaimers,which * 7 // * conditions of the Geant4 Software License << 7 // * govern, are listed with their locations in: * 8 // * LICENSE and available at http://cern.ch/ << 8 // * http://cern.ch/geant4/license * 9 // * include a list of copyright holders. << 10 // * 9 // * * 11 // * Neither the authors of this software syst 10 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 11 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 12 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 13 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file << 14 // * use. * 16 // * for the full disclaimer and the limitatio << 17 // * 15 // * * 18 // * This code implementation is the result << 16 // * This code implementation is the intellectual property of the * 19 // * technical work of the GEANT4 collaboratio << 17 // * GEANT4 collaboration. * 20 // * By using, copying, modifying or distri << 18 // * By copying, distributing or modifying the Program (or any work * 21 // * any work based on the software) you ag << 19 // * based on the Program) you indicate your acceptance of this * 22 // * use in resulting scientific publicati << 20 // * statement, and all its terms. * 23 // * acceptance of all terms of the Geant4 Sof << 24 // ******************************************* 21 // ******************************************************************** 25 // 22 // 26 // 23 // >> 24 // $Id: G4OpenGLImmediateWin32Viewer.cc,v 1.7 2003/06/10 17:13:32 gcosmo Exp $ >> 25 // GEANT4 tag $Name: geant4-05-02-patch-01 $ 27 // 26 // 28 // 27 // 29 // Class G4OpenGLImmediateWin32Viewer : a clas 28 // Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and 30 // G4OpenGLImme 29 // G4OpenGLImmediateViewer. 31 30 >> 31 #ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER >> 32 32 #include "G4OpenGLImmediateWin32Viewer.hh" 33 #include "G4OpenGLImmediateWin32Viewer.hh" 33 #include "G4OpenGLImmediateSceneHandler.hh" << 34 34 35 #include "G4ios.hh" 35 #include "G4ios.hh" 36 36 37 G4OpenGLImmediateWin32Viewer::G4OpenGLImmediat 37 G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer 38 (G4OpenGLImmediateSceneHandler& sceneHandler, << 38 (G4OpenGLImmediateSceneHandler& scene, 39 const G4String& name): 39 const G4String& name): 40 G4OpenGLViewer (sceneHandler), << 40 G4OpenGLViewer (scene), 41 G4OpenGLWin32Viewer (sceneHandler), << 41 G4OpenGLWin32Viewer (scene), 42 G4OpenGLImmediateViewer (sceneHandler), << 42 G4OpenGLImmediateViewer (scene), 43 G4VViewer (sceneHandler, sceneHandler.Incremen << 43 G4VViewer (scene, scene.IncrementViewCount (), name) { 44 44 45 if (fViewId < 0) return; // In case error i 45 if (fViewId < 0) return; // In case error in base class instantiation. 46 } 46 } 47 47 48 void G4OpenGLImmediateWin32Viewer::Initialise 48 void G4OpenGLImmediateWin32Viewer::Initialise () { 49 49 50 // ensure a suitable window was found 50 // ensure a suitable window was found 51 51 52 CreateGLWin32Context (); 52 CreateGLWin32Context (); 53 CreateMainWindow (); 53 CreateMainWindow (); 54 CreateFontLists (); << 55 54 56 // If a double buffer context has been force 55 // If a double buffer context has been forced upon us, ignore the 57 // back buffer for this OpenGLImmediate view 56 // back buffer for this OpenGLImmediate view. 58 glDrawBuffer (GL_FRONT); << 57 if (doublebuffer) { >> 58 doublebuffer = false; >> 59 glDrawBuffer (GL_FRONT); >> 60 } 59 61 60 // clear the buffers and window. 62 // clear the buffers and window. 61 ClearView (); 63 ClearView (); 62 FinishView (); 64 FinishView (); 63 65 64 glDepthFunc (GL_LEQUAL); 66 glDepthFunc (GL_LEQUAL); 65 glDepthMask (GL_TRUE); 67 glDepthMask (GL_TRUE); 66 } 68 } 67 69 68 void G4OpenGLImmediateWin32Viewer::DrawView () 70 void G4OpenGLImmediateWin32Viewer::DrawView () { 69 71 70 // If a double buffer context has been force 72 // If a double buffer context has been forced upon us, ignore the 71 // back buffer for this OpenGLImmediate view 73 // back buffer for this OpenGLImmediate view. 72 glDrawBuffer (GL_FRONT); << 74 if (doublebuffer) { >> 75 doublebuffer = false; >> 76 glDrawBuffer (GL_FRONT); >> 77 } >> 78 >> 79 if (white_background == true) { >> 80 glClearColor (1., 1., 1., 1.); >> 81 } else { >> 82 glClearColor (0., 0., 0., 1.); >> 83 } >> 84 glClearDepth (1.0); 73 85 74 G4ViewParameters::DrawingStyle style = GetVi 86 G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle(); 75 87 76 glViewport (0, 0, getWinWidth(), getWinHeigh << 88 //Make sure current viewer is attached and clean... >> 89 //Win32 version needed >> 90 //glXMakeCurrent (dpy, win, cx); >> 91 glViewport (0, 0, WinSize_x, WinSize_y); >> 92 ClearView (); 77 93 78 if(style!=G4ViewParameters::hlr && 94 if(style!=G4ViewParameters::hlr && 79 haloing_enabled) { 95 haloing_enabled) { 80 96 81 HaloingFirstPass (); 97 HaloingFirstPass (); 82 NeedKernelVisit (); 98 NeedKernelVisit (); 83 ProcessView (); 99 ProcessView (); 84 glFlush (); 100 glFlush (); 85 101 86 HaloingSecondPass (); 102 HaloingSecondPass (); 87 103 88 } 104 } 89 105 90 NeedKernelVisit (); // Always need to visit 106 NeedKernelVisit (); // Always need to visit G4 kernel. 91 ProcessView (); 107 ProcessView (); 92 FinishView (); 108 FinishView (); 93 109 94 } 110 } 95 111 96 ////////////////////////////////////////////// << 112 #endif 97 void G4OpenGLImmediateWin32Viewer::FinishView << 98 ) << 99 ////////////////////////////////////////////// << 100 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! << 101 { << 102 if(!fHDC) return; << 103 << 104 glFlush (); << 105 << 106 // Empty the Windows message queue : << 107 MSG event; << 108 while ( ::PeekMessage(&event, NULL, 0, 0, PM << 109 ::TranslateMessage(&event); << 110 ::DispatchMessage (&event); << 111 } << 112 } << 113 113