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.6 2002/10/16 10:44:15 johna Exp $ >> 25 // GEANT4 tag $Name: geant4-05-01-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 >> 35 #include <GL/gl.h> 34 36 35 #include "G4ios.hh" 37 #include "G4ios.hh" 36 38 37 G4OpenGLImmediateWin32Viewer::G4OpenGLImmediat 39 G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer 38 (G4OpenGLImmediateSceneHandler& sceneHandler, << 40 (G4OpenGLImmediateSceneHandler& scene, 39 const G4String& name): 41 const G4String& name): 40 G4OpenGLViewer (sceneHandler), << 42 G4OpenGLViewer (scene), 41 G4OpenGLWin32Viewer (sceneHandler), << 43 G4OpenGLWin32Viewer (scene), 42 G4OpenGLImmediateViewer (sceneHandler), << 44 G4OpenGLImmediateViewer (scene), 43 G4VViewer (sceneHandler, sceneHandler.Incremen << 45 G4VViewer (scene, scene.IncrementViewCount (), name) { 44 46 45 if (fViewId < 0) return; // In case error i 47 if (fViewId < 0) return; // In case error in base class instantiation. 46 } 48 } 47 49 48 void G4OpenGLImmediateWin32Viewer::Initialise 50 void G4OpenGLImmediateWin32Viewer::Initialise () { 49 51 50 // ensure a suitable window was found 52 // ensure a suitable window was found 51 53 52 CreateGLWin32Context (); 54 CreateGLWin32Context (); 53 CreateMainWindow (); 55 CreateMainWindow (); 54 CreateFontLists (); << 55 56 56 // If a double buffer context has been force 57 // If a double buffer context has been forced upon us, ignore the 57 // back buffer for this OpenGLImmediate view 58 // back buffer for this OpenGLImmediate view. 58 glDrawBuffer (GL_FRONT); << 59 if (doublebuffer) { >> 60 doublebuffer = false; >> 61 glDrawBuffer (GL_FRONT); >> 62 } 59 63 60 // clear the buffers and window. 64 // clear the buffers and window. 61 ClearView (); 65 ClearView (); 62 FinishView (); 66 FinishView (); 63 67 64 glDepthFunc (GL_LEQUAL); 68 glDepthFunc (GL_LEQUAL); 65 glDepthMask (GL_TRUE); 69 glDepthMask (GL_TRUE); 66 } 70 } 67 71 68 void G4OpenGLImmediateWin32Viewer::DrawView () 72 void G4OpenGLImmediateWin32Viewer::DrawView () { 69 73 70 // If a double buffer context has been force 74 // If a double buffer context has been forced upon us, ignore the 71 // back buffer for this OpenGLImmediate view 75 // back buffer for this OpenGLImmediate view. 72 glDrawBuffer (GL_FRONT); << 76 if (doublebuffer) { >> 77 doublebuffer = false; >> 78 glDrawBuffer (GL_FRONT); >> 79 } >> 80 >> 81 if (white_background == true) { >> 82 glClearColor (1., 1., 1., 1.); >> 83 } else { >> 84 glClearColor (0., 0., 0., 1.); >> 85 } >> 86 glClearDepth (1.0); 73 87 74 G4ViewParameters::DrawingStyle style = GetVi 88 G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle(); 75 89 76 glViewport (0, 0, getWinWidth(), getWinHeigh << 90 //Make sure current viewer is attached and clean... >> 91 //Win32 version needed >> 92 //glXMakeCurrent (dpy, win, cx); >> 93 glViewport (0, 0, WinSize_x, WinSize_y); >> 94 ClearView (); 77 95 78 if(style!=G4ViewParameters::hlr && 96 if(style!=G4ViewParameters::hlr && 79 haloing_enabled) { 97 haloing_enabled) { 80 98 81 HaloingFirstPass (); 99 HaloingFirstPass (); 82 NeedKernelVisit (); 100 NeedKernelVisit (); 83 ProcessView (); 101 ProcessView (); 84 glFlush (); 102 glFlush (); 85 103 86 HaloingSecondPass (); 104 HaloingSecondPass (); 87 105 88 } 106 } 89 107 90 NeedKernelVisit (); // Always need to visit 108 NeedKernelVisit (); // Always need to visit G4 kernel. 91 ProcessView (); 109 ProcessView (); 92 FinishView (); 110 FinishView (); 93 111 94 } 112 } 95 113 96 ////////////////////////////////////////////// << 114 #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 115