Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLImmediateWin32Viewer.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28//
29// Class G4OpenGLImmediateWin32Viewer : a class derived from G4OpenGLWin32Viewer and
30// G4OpenGLImmediateViewer.
31
32#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
33
36
37#include "G4ios.hh"
38
39G4OpenGLImmediateWin32Viewer::G4OpenGLImmediateWin32Viewer
40(G4OpenGLImmediateSceneHandler& sceneHandler,
41 const G4String& name):
42G4OpenGLViewer (sceneHandler),
43G4OpenGLWin32Viewer (sceneHandler),
44G4OpenGLImmediateViewer (sceneHandler),
45G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name) {
46
47 if (fViewId < 0) return; // In case error in base class instantiation.
48}
49
50void G4OpenGLImmediateWin32Viewer::Initialise () {
51
52// ensure a suitable window was found
53
54 CreateGLWin32Context ();
55 CreateMainWindow ();
56 CreateFontLists ();
57
58 // If a double buffer context has been forced upon us, ignore the
59 // back buffer for this OpenGLImmediate view.
60 glDrawBuffer (GL_FRONT);
61
62 // clear the buffers and window.
63 ClearView ();
64 FinishView ();
65
66 glDepthFunc (GL_LEQUAL);
67 glDepthMask (GL_TRUE);
68}
69
70void G4OpenGLImmediateWin32Viewer::DrawView () {
71
72 // If a double buffer context has been forced upon us, ignore the
73 // back buffer for this OpenGLImmediate view.
74 glDrawBuffer (GL_FRONT);
75
76 G4ViewParameters::DrawingStyle style = GetViewParameters().GetDrawingStyle();
77
78 glViewport (0, 0, getWinWidth(), getWinHeight());
79
80 if(style!=G4ViewParameters::hlr &&
81 haloing_enabled) {
82
83 HaloingFirstPass ();
84 NeedKernelVisit ();
85 ProcessView ();
86 glFlush ();
87
88 HaloingSecondPass ();
89
90 }
91
92 NeedKernelVisit (); // Always need to visit G4 kernel.
93 ProcessView ();
94 FinishView ();
95
96}
97
98//////////////////////////////////////////////////////////////////////////////
99void G4OpenGLImmediateWin32Viewer::FinishView (
100)
101//////////////////////////////////////////////////////////////////////////////
102//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
103{
104 if(!fHDC) return;
105
106 glFlush ();
107
108 // Empty the Windows message queue :
109 MSG event;
110 while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
111 ::TranslateMessage(&event);
112 ::DispatchMessage (&event);
113 }
114}
115
116#endif
const char * name(G4int ptype)