Geant4
11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLStoredWin32Viewer.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 G4OpenGLStoredWin32Viewer : a class derived from G4OpenGLWin32Viewer and
30
// G4OpenGLStoredViewer.
31
32
#include "
G4OpenGLStoredWin32Viewer.hh
"
33
34
#include "
G4OpenGLStoredSceneHandler.hh
"
35
36
#include "
G4ios.hh
"
37
38
G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer
39
(
G4OpenGLStoredSceneHandler
& sceneHandler,
40
const
G4String
& name):
41
G4OpenGLViewer
(sceneHandler),
42
G4OpenGLWin32Viewer
(sceneHandler),
43
G4OpenGLStoredViewer
(sceneHandler),
44
G4VViewer
(sceneHandler, sceneHandler.IncrementViewCount (), name) {
45
46
if
(
fViewId
< 0)
return
;
// In case error in base class instantiation.
47
}
48
49
void
G4OpenGLStoredWin32Viewer::Initialise
() {
50
51
//Check that G4OpenGLWin32Viewer got a double buffered colour visual
52
53
CreateGLWin32Context
();
54
CreateMainWindow
();
55
CreateFontLists
();
56
57
// clear the buffers and window.
58
ClearView
();
59
FinishView
();
60
61
glDepthFunc (GL_LEQUAL);
62
glDepthMask (GL_TRUE);
63
}
64
65
void
G4OpenGLStoredWin32Viewer::DrawView
() {
66
67
glViewport (0, 0,
getWinWidth
(),
getWinHeight
());
68
69
G4ViewParameters::DrawingStyle
style =
GetViewParameters
().
GetDrawingStyle
();
70
71
//See if things have changed from last time and remake if necessary...
72
// The fNeedKernelVisit flag might have been set by the user in
73
// /vis/viewer/rebuild, but if not, make decision and set flag only
74
// if necessary...
75
if
(!
fNeedKernelVisit
)
KernelVisitDecision
();
76
fLastVP
=
fVP
;
77
G4bool
kernelVisitWasNeeded =
fNeedKernelVisit
;
// Keep (ProcessView resets).
78
ProcessView
();
79
80
if
(style!=
G4ViewParameters::hlr
&&
81
haloing_enabled
) {
82
83
HaloingFirstPass
();
84
DrawDisplayLists
();
85
glFlush ();
86
87
HaloingSecondPass
();
88
89
DrawDisplayLists
();
90
FinishView
();
91
92
}
else
{
93
94
// If kernel visit was needed, drawing and FinishView will already
95
// have been done, so...
96
if
(!kernelVisitWasNeeded) {
97
DrawDisplayLists
();
98
FinishView
();
99
}
else
{
100
// However, union cutaways are implemented in DrawDisplayLists, so make
101
// an extra pass...
102
if
(
fVP
.
IsCutaway
() &&
103
fVP
.
GetCutawayMode
() ==
G4ViewParameters::cutawayUnion
) {
104
ClearView
();
105
DrawDisplayLists
();
106
FinishView
();
107
}
else
{
// ADD TO AVOID KernelVisit=1 and nothing to display
108
DrawDisplayLists
();
109
FinishView
();
110
}
111
}
112
}
113
}
114
115
//////////////////////////////////////////////////////////////////////////////
116
void
G4OpenGLStoredWin32Viewer::FinishView
(
117
)
118
//////////////////////////////////////////////////////////////////////////////
119
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
120
{
121
if
(!
fHDC
)
return
;
122
123
glFlush ();
124
GLint renderMode;
125
glGetIntegerv(GL_RENDER_MODE, &renderMode);
126
if
(renderMode == GL_RENDER) ::SwapBuffers(
fHDC
);
127
128
// Empty the Windows message queue :
129
MSG event;
130
while
( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
131
::TranslateMessage(&event);
132
::DispatchMessage (&event);
133
}
134
}
G4OpenGLStoredSceneHandler.hh
G4OpenGLStoredWin32Viewer.hh
G4bool
bool G4bool
Definition
G4Types.hh:86
G4ios.hh
G4OpenGLStoredSceneHandler
Definition
G4OpenGLStoredSceneHandler.hh:43
G4OpenGLStoredViewer
Definition
G4OpenGLStoredViewer.hh:44
G4OpenGLStoredViewer::fLastVP
G4ViewParameters fLastVP
Definition
G4OpenGLStoredViewer.hh:64
G4OpenGLStoredViewer::KernelVisitDecision
void KernelVisitDecision()
Definition
G4OpenGLStoredViewer.cc:56
G4OpenGLStoredViewer::DrawDisplayLists
void DrawDisplayLists()
Definition
G4OpenGLStoredViewer.cc:150
G4OpenGLStoredWin32Viewer::G4OpenGLStoredWin32Viewer
G4OpenGLStoredWin32Viewer(G4OpenGLStoredSceneHandler &scene, const G4String &name="")
Definition
G4OpenGLStoredWin32Viewer.cc:39
G4OpenGLStoredWin32Viewer::Initialise
void Initialise()
Definition
G4OpenGLStoredWin32Viewer.cc:49
G4OpenGLStoredWin32Viewer::FinishView
void FinishView()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition
G4OpenGLStoredWin32Viewer.cc:116
G4OpenGLStoredWin32Viewer::DrawView
void DrawView()
Definition
G4OpenGLStoredWin32Viewer.cc:65
G4OpenGLViewer
Definition
G4OpenGLViewer.hh:95
G4OpenGLViewer::haloing_enabled
G4bool haloing_enabled
Definition
G4OpenGLViewer.hh:189
G4OpenGLViewer::CreateFontLists
virtual void CreateFontLists()
Definition
G4OpenGLViewer.hh:135
G4OpenGLViewer::getWinHeight
unsigned int getWinHeight() const
Definition
G4OpenGLViewer.cc:932
G4OpenGLViewer::getWinWidth
unsigned int getWinWidth() const
Definition
G4OpenGLViewer.cc:928
G4OpenGLViewer::ClearView
void ClearView()
Definition
G4OpenGLViewer.cc:150
G4OpenGLViewer::HaloingSecondPass
void HaloingSecondPass()
Definition
G4OpenGLViewer.cc:409
G4OpenGLViewer::HaloingFirstPass
void HaloingFirstPass()
Definition
G4OpenGLViewer.cc:387
G4OpenGLWin32Viewer
Definition
G4OpenGLWin32Viewer.hh:41
G4OpenGLWin32Viewer::CreateMainWindow
virtual void CreateMainWindow()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition
G4OpenGLWin32Viewer.cc:91
G4OpenGLWin32Viewer::fHDC
HDC fHDC
Definition
G4OpenGLWin32Viewer.hh:53
G4OpenGLWin32Viewer::CreateGLWin32Context
void CreateGLWin32Context()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
Definition
G4OpenGLWin32Viewer.cc:83
G4String
Definition
G4String.hh:62
G4VViewer
Definition
G4VViewer.hh:52
G4VViewer::fNeedKernelVisit
G4bool fNeedKernelVisit
Definition
G4VViewer.hh:266
G4VViewer::GetViewParameters
const G4ViewParameters & GetViewParameters() const
G4VViewer::ProcessView
void ProcessView()
Definition
G4VViewer.cc:108
G4VViewer::fViewId
G4int fViewId
Definition
G4VViewer.hh:254
G4VViewer::fVP
G4ViewParameters fVP
Definition
G4VViewer.hh:257
G4ViewParameters::GetCutawayMode
CutawayMode GetCutawayMode() const
G4ViewParameters::IsCutaway
G4bool IsCutaway() const
G4ViewParameters::DrawingStyle
DrawingStyle
Definition
G4ViewParameters.hh:94
G4ViewParameters::hlr
@ hlr
Definition
G4ViewParameters.hh:96
G4ViewParameters::cutawayUnion
@ cutawayUnion
Definition
G4ViewParameters.hh:103
G4ViewParameters::GetDrawingStyle
DrawingStyle GetDrawingStyle() const
geant4-v11.2.2
source
visualization
OpenGL
src
G4OpenGLStoredWin32Viewer.cc
Generated by
1.12.0