Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4OpenGLWin32Viewer Class Reference

#include <G4OpenGLWin32Viewer.hh>

+ Inheritance diagram for G4OpenGLWin32Viewer:

Public Member Functions

 G4OpenGLWin32Viewer (G4OpenGLSceneHandler &scene)
 
virtual ~G4OpenGLWin32Viewer ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void SetView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void ShowView ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
- Public Member Functions inherited from G4OpenGLViewer
void ClearView ()
 
void ClearViewWithoutFlush ()
 
virtual bool exportImage (std::string name="", int width=-1, int height=-1)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
- Public Member Functions inherited from G4VViewer
 G4VViewer (G4VSceneHandler &, G4int id, const G4String &name="")
 
virtual ~G4VViewer ()
 
virtual void Initialise ()
 
virtual void DrawView ()=0
 
void RefreshView ()
 
virtual void FinishView ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
SceneTreeSceneAccessSceneTreeScene ()
 
G4SceneTreeItemAccessSceneTree ()
 
void UpdateGUISceneTree ()
 
const G4StringGetName () const
 
const G4StringGetShortName () const
 
void SetName (const G4String &)
 
G4int GetViewId () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4ViewParametersGetViewParameters () const
 
const G4ViewParametersGetDefaultViewParameters () const
 
G4double GetKernelVisitElapsedTimeSeconds () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
void SetViewParameters (const G4ViewParameters &vp)
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
void SetNeedKernelVisit (G4bool need)
 
void NeedKernelVisit ()
 
void ProcessView ()
 

Protected Member Functions

void GetWin32Connection ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
void CreateGLWin32Context ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
virtual void CreateMainWindow ()
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
 
- Protected Member Functions inherited from G4OpenGLViewer
 G4OpenGLViewer (G4OpenGLSceneHandler &scene)
 
virtual ~G4OpenGLViewer ()
 
void ResetView ()
 
virtual void DrawText (const G4Text &)
 
void ChangePointSize (G4double size)
 
void ChangeLineWidth (G4double width)
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
virtual void CreateFontLists ()
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
void setExportSize (G4int, G4int)
 
bool setExportFilename (G4String name, G4bool inc=true)
 
std::string getRealPrintFilename ()
 
unsigned int getWinWidth () const
 
unsigned int getWinHeight () const
 
G4bool sizeHasChanged ()
 
GLdouble getSceneNearWidth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneDepth ()
 
void addExportImageFormat (std::string format)
 
G4bool isGl2psWriting ()
 
G4bool isFramebufferReady ()
 
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
 
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
 
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
- Protected Member Functions inherited from G4VViewer
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 

Protected Attributes

HDC fHDC
 
G4bool fMouseHovered
 
G4bool fMousePressed
 
G4int fMousePressedX
 
G4int fMousePressedY
 
- Protected Attributes inherited from G4OpenGLViewer
G4bool fPrintColour
 
G4bool fVectoredPs
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
G4Colour background
 
G4bool transparency_enabled
 
G4bool antialiasing_enabled
 
G4bool haloing_enabled
 
G4gl2psfGL2PSAction
 
G4double fRot_sens
 
G4double fPan_sens
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
std::vector< std::string > fExportImageFormatVector
 
std::string fDefaultExportImageFormat
 
std::string fExportImageFormat
 
int fExportFilenameIndex
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
- Protected Attributes inherited from G4VViewer
G4VSceneHandlerfSceneHandler
 
G4int fViewId
 
G4String fName
 
G4String fShortName
 
G4ViewParameters fVP
 
G4ViewParameters fDefaultVP
 
G4double fKernelVisitElapsedTimeSeconds = 999.
 
SceneTreeScene fSceneTreeScene
 
G4SceneTreeItem fSceneTree
 
G4bool fNeedKernelVisit
 

Detailed Description

Definition at line 41 of file G4OpenGLWin32Viewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLWin32Viewer()

G4OpenGLWin32Viewer::G4OpenGLWin32Viewer ( G4OpenGLSceneHandler & scene)

Definition at line 161 of file G4OpenGLWin32Viewer.cc.

164:G4VViewer (scene, -1)
165,G4OpenGLViewer (scene)
166,fMouseHovered(false)
167,fMousePressed(false)
170,fHDC(0)
171,fWindow(0)
172,fHGLRC(0)
173,fInCreateWindow(false)
174//////////////////////////////////////////////////////////////////////////////
175//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
176{
177}
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition G4VViewer.cc:49

◆ ~G4OpenGLWin32Viewer()

G4OpenGLWin32Viewer::~G4OpenGLWin32Viewer ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 180 of file G4OpenGLWin32Viewer.cc.

184{
185 // This is the end (Jim Morisson).
186 if (fViewId >= 0) {
187 if(wglGetCurrentContext()!=NULL) wglMakeCurrent(NULL,NULL);
188 if(fHGLRC) {
189 wglDeleteContext(fHGLRC);
190 fHGLRC = NULL;
191 }
192
193 if(fWindow) {
194 ::SetWindowLongPtr(fWindow,GWLP_USERDATA,LONG(NULL));
195 if(fHDC) ::ReleaseDC(fWindow,fHDC);
196 ::DestroyWindow(fWindow);
197 }
198 }
199}
G4int fViewId
Definition G4VViewer.hh:254

Member Function Documentation

◆ CreateGLWin32Context()

void G4OpenGLWin32Viewer::CreateGLWin32Context ( )
protected

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 83 of file G4OpenGLWin32Viewer.cc.

87{
88}

Referenced by G4OpenGLImmediateWin32Viewer::Initialise(), and G4OpenGLStoredWin32Viewer::Initialise().

◆ CreateMainWindow()

void G4OpenGLWin32Viewer::CreateMainWindow ( )
protectedvirtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 91 of file G4OpenGLWin32Viewer.cc.

95{
96 if(fWindow) return; //Done.
97
98 // Bill Gates stuff...
99 static const char className[] = "G4OpenGLWin32";
100 static G4bool done = false;
101 if(done==false) {
102 WNDCLASS wc;
103 wc.style = CS_HREDRAW | CS_VREDRAW;
104 wc.lpfnWndProc = (WNDPROC)WindowProc;
105 wc.cbClsExtra = 0;
106 wc.cbWndExtra = 0;
107 wc.hInstance = ::GetModuleHandle(NULL);
108 wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
109 wc.hCursor = LoadCursor(NULL,IDC_CROSS);
110 wc.hbrBackground = NULL;
111 wc.lpszMenuName = className;
112 wc.lpszClassName = className;
113 ::RegisterClass(&wc);
114 done = true;
115 }
116
118
119 G4int x_res=GetSystemMetrics(SM_CXSCREEN);
120 G4int y_res=GetSystemMetrics(SM_CYSCREEN);
121
122 //FIXME : NOT tested !
123 fWindow = ::CreateWindowEx(0, className,fName.c_str(),
124 WS_OVERLAPPEDWINDOW,
125 //WS_CHILD | WS_VISIBLE,
126 // 0,0,
130 NULL, NULL,
131 ::GetModuleHandle(NULL),
132 NULL);
133 if(!fWindow) return;
134
135 ::SetWindowLongPtr(fWindow,GWLP_USERDATA,LONG_PTR(this));
136
137 // initialize OpenGL rendering :
138 fHDC = ::GetDC(fWindow);
139 if( fHDC && (SetWindowPixelFormat(fHDC)==TRUE) ) {
140 fHGLRC = ::wglCreateContext(fHDC);
141 }
142
143 if(fHDC && fHGLRC) {
144 ::wglMakeCurrent(fHDC,fHGLRC);
145 }
146
147 //G.Barrand : avoid to indirectly pass in
148 // WindowProc/[WM_SIZE,WM_PAINT]/This->DrawView()
149 // from this method. Else we have crash.
150 fInCreateWindow = true;
151
152 ::SetForegroundWindow(fWindow);
153 ::ShowWindow(fWindow,SW_SHOWDEFAULT);
154 ::UpdateWindow(fWindow);
155 ::DrawMenuBar(fWindow);
156
157 fInCreateWindow = false;
158}
bool G4bool
Definition G4Types.hh:86
int G4int
Definition G4Types.hh:85
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
G4String fName
Definition G4VViewer.hh:255
G4ViewParameters fVP
Definition G4VViewer.hh:257
G4int GetWindowAbsoluteLocationHintY(G4int) const
unsigned int GetWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const
#define TRUE
Definition globals.hh:41

Referenced by G4OpenGLImmediateWin32Viewer::Initialise(), and G4OpenGLStoredWin32Viewer::Initialise().

◆ GetWin32Connection()

void G4OpenGLWin32Viewer::GetWin32Connection ( )
protected

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Definition at line 75 of file G4OpenGLWin32Viewer.cc.

79{
80}

◆ SetView()

void G4OpenGLWin32Viewer::SetView ( )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4OpenGLViewer.

Definition at line 47 of file G4OpenGLWin32Viewer.cc.

51{
52 if(!fHDC) return;
53 if(!fHGLRC) return;
54 ::wglMakeCurrent(fHDC,fHGLRC);
56}

◆ ShowView()

void G4OpenGLWin32Viewer::ShowView ( void )
virtual

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

Reimplemented from G4VViewer.

Definition at line 59 of file G4OpenGLWin32Viewer.cc.

63{
64 if(!fHDC) return;
65 glFlush ();
66 // Empty the Windows message queue :
67 MSG event;
68 while ( ::PeekMessage(&event, NULL, 0, 0, PM_REMOVE) ) {
69 ::TranslateMessage(&event);
70 ::DispatchMessage (&event);
71 }
72}

Member Data Documentation

◆ fHDC

◆ fMouseHovered

G4bool G4OpenGLWin32Viewer::fMouseHovered
protected

Definition at line 55 of file G4OpenGLWin32Viewer.hh.

◆ fMousePressed

G4bool G4OpenGLWin32Viewer::fMousePressed
protected

Definition at line 56 of file G4OpenGLWin32Viewer.hh.

◆ fMousePressedX

G4int G4OpenGLWin32Viewer::fMousePressedX
protected

Definition at line 57 of file G4OpenGLWin32Viewer.hh.

◆ fMousePressedY

G4int G4OpenGLWin32Viewer::fMousePressedY
protected

Definition at line 57 of file G4OpenGLWin32Viewer.hh.


The documentation for this class was generated from the following files: