Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes
G4OpenGLStoredXViewer Class Reference

#include <G4OpenGLStoredXViewer.hh>

Inheritance diagram for G4OpenGLStoredXViewer:
G4OpenGLXViewer G4OpenGLStoredViewer G4OpenGLViewer G4OpenGLViewer G4VViewer G4VViewer

Public Member Functions

void ClearView ()
 
void ClearViewWithoutFlush ()
 
std::vector< G4ThreeVectorComputeFlyThrough (G4Vector3D *)
 
void DrawText (const G4Text &)
 
void DrawView ()
 
virtual bool exportImage (std::string name="", int width=-1, int height=-1)
 
void FinishView ()
 
 G4OpenGLStoredXViewer (G4OpenGLStoredSceneHandler &scene, const G4String &name="")
 
const G4VisAttributesGetApplicableVisAttributes (const G4VisAttributes *) const
 
const G4ViewParametersGetDefaultViewParameters () const
 
const G4StringGetName () const
 
virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * GetPrivateVisAttributesModifiers () const
 
G4VSceneHandlerGetSceneHandler () const
 
const G4StringGetShortName () const
 
G4int GetViewId () const
 
const G4ViewParametersGetViewParameters () const
 
void Initialise ()
 
void NeedKernelVisit ()
 
void ProcessView ()
 
void RefreshView ()
 
void SetDefaultViewParameters (const G4ViewParameters &vp)
 
bool setExportImageFormat (std::string format, bool quiet=false)
 
void SetName (const G4String &)
 
void SetNeedKernelVisit (G4bool need)
 
void SetView ()
 
void SetViewParameters (const G4ViewParameters &vp)
 
void ShowView ()
 
virtual ~G4OpenGLStoredXViewer ()
 

Protected Member Functions

void addExportImageFormat (std::string format)
 
void AddPrimitiveForASingleFrame (const G4Circle &circle)
 
void AddPrimitiveForASingleFrame (const G4Text &text)
 
void ChangeLineWidth (G4double width)
 
void ChangePointSize (G4double size)
 
virtual G4bool CompareForKernelVisit (G4ViewParameters &)
 
virtual void CreateFontLists ()
 
void CreateGLXContext (XVisualInfo *vi)
 
virtual void CreateMainWindow ()
 
virtual void DisplayTimePOColourModification (G4Colour &, size_t)
 
void DrawDisplayLists ()
 
void g4GlFrustum (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GlOrtho (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
 
void g4GluLookAt (GLdouble eyex, GLdouble eyey, GLdouble eyez, GLdouble centerx, GLdouble centery, GLdouble centerz, GLdouble upx, GLdouble upy, GLdouble upz)
 
void g4GluPickMatrix (GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
 
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails (GLdouble x, GLdouble y)
 
std::string getRealPrintFilename ()
 
GLdouble getSceneDepth ()
 
GLdouble getSceneFarWidth ()
 
GLdouble getSceneNearWidth ()
 
unsigned int getWinHeight () const
 
unsigned int getWinWidth () const
 
void GetXConnection ()
 
void HaloingFirstPass ()
 
void HaloingSecondPass ()
 
void HLRFirstPass ()
 
void HLRSecondPass ()
 
void HLRThirdPass ()
 
void InitializeGLView ()
 
G4bool isFramebufferReady ()
 
G4bool isGl2psWriting ()
 
void KernelVisitDecision ()
 
virtual G4String Pick (GLdouble x, GLdouble y)
 
virtual G4bool POSelected (size_t)
 
void ResetView ()
 
void ResizeGLView ()
 
void ResizeWindow (unsigned int, unsigned int)
 
void rotateScene (G4double dx, G4double dy)
 
void rotateSceneToggle (G4double dx, G4double dy)
 
bool setExportFilename (G4String name, G4bool inc=true)
 
void setExportSize (G4int, G4int)
 
void SetTouchable (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath)
 
G4bool sizeHasChanged ()
 
virtual G4bool TOSelected (size_t)
 
void TouchableSetColour (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, const G4Colour &)
 
void TouchableSetVisibility (const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &fullPath, G4bool visibility)
 

Protected Attributes

G4bool antialiasing_enabled
 
G4intattributeList
 
G4Colour background
 
char charViewName [100]
 
XClassHint * class_hints
 
Colormap cmap
 
GLXContext cxMaster
 
Display * dpy
 
G4int errorBase
 
XEvent event
 
G4int eventBase
 
std::string fDefaultExportImageFormat
 
G4ViewParameters fDefaultVP
 
G4bool fDepthTestEnable
 
int fExportFilenameIndex
 
std::string fExportImageFormat
 
std::vector< std::string > fExportImageFormatVector
 
G4OpenGLStoredSceneHandlerfG4OpenGLStoredSceneHandler
 
G4OpenGL2PSActionfGL2PSAction
 
G4ViewParameters fLastVP
 
G4String fName
 
G4bool fNeedKernelVisit
 
G4Colour fOldDisplayListColor
 
G4OpenGLSceneHandlerfOpenGLSceneHandler
 
G4double fPan_sens
 
G4bool fPrintColour
 
G4int fPrintSizeX
 
G4int fPrintSizeY
 
G4double fRot_sens
 
G4VSceneHandlerfSceneHandler
 
G4String fShortName
 
G4bool fVectoredPs
 
G4int fViewId
 
G4ViewParameters fVP
 
unsigned int fWinSize_x
 
unsigned int fWinSize_y
 
G4bool haloing_enabled
 
Pixmap icon_pixmap
 
XTextProperty iconName
 
G4int major
 
G4int minor
 
XSizeHints * norm_hints
 
XSizeHints * size_hints
 
XSetWindowAttributes swa
 
G4bool transparency_enabled
 
XVisualInfo * vi
 
XVisualInfo * vi_immediate
 
XVisualInfo * vi_stored
 
GLXDrawable win
 
XTextProperty windowName
 
XWMHints * wm_hints
 
Atom Xatom
 
XWindowAttributes xwa
 

Static Protected Attributes

static int dblBuf_RGBA [13]
 
static int snglBuf_RGBA [12]
 
static XVisualInfo * vi_double_buffer = 0
 
static XVisualInfo * vi_single_buffer = 0
 

Private Member Functions

G4int getRealExportHeight ()
 
G4int getRealExportWidth ()
 
GLubyte * grabPixels (int inColor, unsigned int width, unsigned int height)
 
bool printGl2PS ()
 
bool printNonVectoredEPS ()
 
bool printVectoredEPS ()
 
void rotateSceneInViewDirection (G4double dx, G4double dy)
 
void rotateSceneThetaPhi (G4double dx, G4double dy)
 

Private Attributes

G4String fDefaultExportFilename
 
G4String fExportFilename
 
int fGl2psDefaultLineWith
 
int fGl2psDefaultPointSize
 
bool fGlViewInitialized
 
bool fIsGettingPickInfos
 
G4float fPointSize
 
G4bool fSizeHasChanged
 
GLXContext tmp_cx
 

Detailed Description

Definition at line 41 of file G4OpenGLStoredXViewer.hh.

Constructor & Destructor Documentation

◆ G4OpenGLStoredXViewer()

G4OpenGLStoredXViewer::G4OpenGLStoredXViewer ( G4OpenGLStoredSceneHandler scene,
const G4String name = "" 
)

Definition at line 39 of file G4OpenGLStoredXViewer.cc.

42 : G4VViewer (sceneHandler, sceneHandler.IncrementViewCount (), name),
43 G4OpenGLViewer (sceneHandler),
44 G4OpenGLXViewer (sceneHandler),
45 G4OpenGLStoredViewer (sceneHandler)
46{
47 if (fViewId < 0) return; // In case error in base class instantiation.
48
49 if (!vi_stored) {
50 fViewId = -1; // This flags an error.
51 G4cerr << "G4OpenGLStoredXViewer::G4OpenGLStoredXViewer -"
52 " G4OpenGLXViewer couldn't get a visual." << G4endl;
53 return;
54 }
55}
G4GLOB_DLL std::ostream G4cerr
#define G4endl
Definition: G4ios.hh:57
G4OpenGLStoredViewer(G4OpenGLStoredSceneHandler &scene)
G4OpenGLViewer(G4OpenGLSceneHandler &scene)
XVisualInfo * vi_stored
G4OpenGLXViewer(G4OpenGLSceneHandler &scene)
G4int fViewId
Definition: G4VViewer.hh:216
G4VViewer(G4VSceneHandler &, G4int id, const G4String &name="")
Definition: G4VViewer.cc:46
const char * name(G4int ptype)

References G4VViewer::fViewId, G4cerr, G4endl, and G4OpenGLXViewer::vi_stored.

◆ ~G4OpenGLStoredXViewer()

G4OpenGLStoredXViewer::~G4OpenGLStoredXViewer ( )
virtual

Definition at line 57 of file G4OpenGLStoredXViewer.cc.

57{}

Member Function Documentation

◆ addExportImageFormat()

void G4OpenGLViewer::addExportImageFormat ( std::string  format)
protectedinherited

Definition at line 1288 of file G4OpenGLViewer.cc.

1288 {
1289 fExportImageFormatVector.push_back(format);
1290}
std::vector< std::string > fExportImageFormatVector

References G4OpenGLViewer::fExportImageFormatVector.

Referenced by G4OpenGLQtViewer::G4OpenGLQtViewer(), and G4OpenGLViewer::G4OpenGLViewer().

◆ AddPrimitiveForASingleFrame() [1/2]

void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame ( const G4Circle circle)
protectedinherited

Definition at line 485 of file G4OpenGLStoredViewer.cc.

486{
487 // We don't want this to get into a display list or a TODL or a PODL so
488 // use the fMemoryForDisplayLists flag.
491 fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(circle);
492 fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
493}
bool G4bool
Definition: G4Types.hh:86
G4OpenGLStoredSceneHandler & fG4OpenGLStoredSceneHandler

References G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, and G4OpenGLStoredSceneHandler::fMemoryForDisplayLists.

◆ AddPrimitiveForASingleFrame() [2/2]

void G4OpenGLStoredViewer::AddPrimitiveForASingleFrame ( const G4Text text)
protectedinherited

Definition at line 475 of file G4OpenGLStoredViewer.cc.

476{
477 // We don't want this to get into a display list or a TODL or a PODL so
478 // use the fMemoryForDisplayLists flag.
481 fG4OpenGLStoredSceneHandler.G4OpenGLStoredSceneHandler::AddPrimitive(text);
482 fG4OpenGLStoredSceneHandler.fMemoryForDisplayLists = memoryForDisplayListsKeep;
483}

References G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, and G4OpenGLStoredSceneHandler::fMemoryForDisplayLists.

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ ChangeLineWidth()

void G4OpenGLViewer::ChangeLineWidth ( G4double  width)
protectedinherited

Change LineSize on gl2ps if needed

Definition at line 810 of file G4OpenGLViewer.cc.

810 {
811
812 if (isGl2psWriting()) {
813 fGL2PSAction->setLineWidth(int(width));
814 } else {
815 glLineWidth (width);
816 }
817}
void setLineWidth(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
G4OpenGL2PSAction * fGL2PSAction
G4bool isGl2psWriting()

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setLineWidth().

Referenced by G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLViewer::HaloingFirstPass(), and G4OpenGLViewer::HaloingSecondPass().

◆ ChangePointSize()

void G4OpenGLViewer::ChangePointSize ( G4double  size)
protectedinherited

Change PointSize on gl2ps if needed

Definition at line 798 of file G4OpenGLViewer.cc.

798 {
799
800 if (isGl2psWriting()) {
801 fGL2PSAction->setPointSize(int(size));
802 } else {
803 glPointSize (size);
804 }
805}
void setPointSize(int)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::isGl2psWriting(), and G4OpenGL2PSAction::setPointSize().

Referenced by G4OpenGLSceneHandler::AddPrimitive().

◆ ClearView()

void G4OpenGLViewer::ClearView ( void  )
virtualinherited

◆ ClearViewWithoutFlush()

void G4OpenGLViewer::ClearViewWithoutFlush ( )
inherited

Definition at line 214 of file G4OpenGLViewer.cc.

214 {
215 // Ready for clear ?
216 // See : http://lists.apple.com/archives/mac-opengl/2012/Jul/msg00038.html
217 if(!isFramebufferReady()) {
218 return;
219 }
220
221 glClearColor (background.GetRed(),
224 1.);
225 glClearDepth (1.0);
226 //Below line does not compile with Mesa includes.
227 //glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
228 glClear (GL_COLOR_BUFFER_BIT);
229 glClear (GL_DEPTH_BUFFER_BIT);
230 glClear (GL_STENCIL_BUFFER_BIT);
231}
G4double GetBlue() const
Definition: G4Colour.hh:154
G4double GetRed() const
Definition: G4Colour.hh:152
G4double GetGreen() const
Definition: G4Colour.hh:153

References G4OpenGLViewer::background, G4Colour::GetBlue(), G4Colour::GetGreen(), G4Colour::GetRed(), and G4OpenGLViewer::isFramebufferReady().

Referenced by G4OpenGLViewer::ClearView().

◆ CompareForKernelVisit()

G4bool G4OpenGLStoredViewer::CompareForKernelVisit ( G4ViewParameters lastVP)
protectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 67 of file G4OpenGLStoredViewer.cc.

67 {
68
69 if (
70 (lastVP.GetDrawingStyle () != fVP.GetDrawingStyle ()) ||
72 (lastVP.IsAuxEdgeVisible () != fVP.IsAuxEdgeVisible ()) ||
73 (lastVP.IsCulling () != fVP.IsCulling ()) ||
74 (lastVP.IsCullingInvisible () != fVP.IsCullingInvisible ()) ||
75 (lastVP.IsDensityCulling () != fVP.IsDensityCulling ()) ||
76 (lastVP.IsCullingCovered () != fVP.IsCullingCovered ()) ||
77 (lastVP.GetCBDAlgorithmNumber() !=
79 // Note: Section and Cutaway can reveal back-facing faces. If
80 // backface culling is implemented, the image can look strange because
81 // the back-facing faces are not there. For the moment, we have disabled
82 // (commented out) backface culling (it seems not to affect performance -
83 // in fact, performance seems to improve), so there is no problem.
84 (lastVP.IsSection () != fVP.IsSection ()) ||
85 // Section (DCUT) is NOT implemented locally so we need to visit the kernel.
86 // (lastVP.IsCutaway () != fVP.IsCutaway ()) ||
87 // Cutaways are implemented locally so we do not need to visit the kernel.
88 (lastVP.IsExplode () != fVP.IsExplode ()) ||
89 (lastVP.GetNoOfSides () != fVP.GetNoOfSides ()) ||
92 (lastVP.IsMarkerNotHidden () != fVP.IsMarkerNotHidden ()) ||
98 (lastVP.IsPicking () != fVP.IsPicking ()) ||
99 (lastVP.GetVisAttributesModifiers() !=
101 (lastVP.IsSpecialMeshRendering() !=
103 )
104 return true;
105
106 if (lastVP.IsDensityCulling () &&
107 (lastVP.GetVisibleDensity () != fVP.GetVisibleDensity ()))
108 return true;
109
110// /**************************************************************
111// If section (DCUT) is implemented locally, comment this out.
112 if (lastVP.IsSection () &&
113 (lastVP.GetSectionPlane () != fVP.GetSectionPlane ()))
114 return true;
115// ***************************************************************/
116
117 /**************************************************************
118 If cutaways are implemented locally, comment this out.
119 if (lastVP.IsCutaway ()) {
120 if (lastVP.GetCutawayPlanes ().size () !=
121 fVP.GetCutawayPlanes ().size ()) return true;
122 for (size_t i = 0; i < lastVP.GetCutawayPlanes().size(); ++i)
123 if (lastVP.GetCutawayPlanes()[i] != fVP.GetCutawayPlanes()[i])
124 return true;
125 }
126 ***************************************************************/
127
128 if (lastVP.GetCBDAlgorithmNumber() > 0) {
129 if (lastVP.GetCBDParameters().size() != fVP.GetCBDParameters().size()) return true;
130 else if (lastVP.GetCBDParameters() != fVP.GetCBDParameters()) return true;
131 }
132
133 if (lastVP.IsExplode () &&
134 (lastVP.GetExplodeFactor () != fVP.GetExplodeFactor ()))
135 return true;
136
137 if (lastVP.IsSpecialMeshRendering() &&
139 return true;
140
141 // Time window parameters operate on the existing database so no need
142 // to rebuild even if they change.
143
144 return false;
145}
G4ViewParameters fVP
Definition: G4VViewer.hh:219
const std::vector< G4ModelingParameters::VisAttributesModifier > & GetVisAttributesModifiers() const
G4int GetNoOfSides() const
G4bool IsSpecialMeshRendering() const
G4double GetExplodeFactor() const
G4int GetNumberOfCloudPoints() const
G4bool IsMarkerNotHidden() const
G4double GetGlobalLineWidthScale() const
const G4Colour & GetBackgroundColour() const
G4bool IsSection() const
G4bool IsPicking() const
G4bool IsCulling() const
const G4VisAttributes * GetDefaultTextVisAttributes() const
G4bool IsExplode() const
const std::vector< G4double > & GetCBDParameters() const
G4int GetCBDAlgorithmNumber() const
const std::vector< G4ModelingParameters::PVNameCopyNo > & GetSpecialMeshVolumes() const
G4double GetGlobalMarkerScale() const
G4bool IsCullingInvisible() const
const G4VisAttributes * GetDefaultVisAttributes() const
G4bool IsDensityCulling() const
G4double GetVisibleDensity() const
G4bool IsCullingCovered() const
const G4Plane3D & GetSectionPlane() const
DrawingStyle GetDrawingStyle() const
G4bool IsAuxEdgeVisible() const
const G4Colour & GetColour() const

References G4VViewer::fVP, G4ViewParameters::GetBackgroundColour(), G4ViewParameters::GetCBDAlgorithmNumber(), G4ViewParameters::GetCBDParameters(), G4VisAttributes::GetColour(), G4ViewParameters::GetDefaultTextVisAttributes(), G4ViewParameters::GetDefaultVisAttributes(), G4ViewParameters::GetDrawingStyle(), G4ViewParameters::GetExplodeFactor(), G4ViewParameters::GetGlobalLineWidthScale(), G4ViewParameters::GetGlobalMarkerScale(), G4ViewParameters::GetNoOfSides(), G4ViewParameters::GetNumberOfCloudPoints(), G4ViewParameters::GetSectionPlane(), G4ViewParameters::GetSpecialMeshVolumes(), G4ViewParameters::GetVisAttributesModifiers(), G4ViewParameters::GetVisibleDensity(), G4ViewParameters::IsAuxEdgeVisible(), G4ViewParameters::IsCulling(), G4ViewParameters::IsCullingCovered(), G4ViewParameters::IsCullingInvisible(), G4ViewParameters::IsDensityCulling(), G4ViewParameters::IsExplode(), G4ViewParameters::IsMarkerNotHidden(), G4ViewParameters::IsPicking(), G4ViewParameters::IsSection(), and G4ViewParameters::IsSpecialMeshRendering().

Referenced by G4OpenGLStoredViewer::KernelVisitDecision().

◆ ComputeFlyThrough()

std::vector< G4ThreeVector > G4VViewer::ComputeFlyThrough ( G4Vector3D )
inherited

Definition at line 215 of file G4VViewer.cc.

216{
217 enum CurveType {
218 Bezier,
219 G4SplineTest};
220
221 // Choose a curve type (for testing)
222// int myCurveType = Bezier;
223
224 // number if step points
225 int stepPoints = 500;
226
227
228 G4Spline spline;
229
230
231 // At the moment we don't use the aVect parameters, but build it here :
232 // Good step points for exampleB5
233 spline.AddSplinePoint(G4Vector3D(0,1000,-14000));
234 spline.AddSplinePoint(G4Vector3D(0,1000,0));
235 spline.AddSplinePoint(G4Vector3D(-4000,1000,4000));
236
237
238 std::vector <G4ThreeVector> viewVect;
239
240// if(myCurveType == Bezier) {
241
242
243 // Draw the spline
244
245 for (int i = 0; i < stepPoints; i++) {
246 float t = (float)i / (float)stepPoints;
247 G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
248 // G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
249
250 // viewParam->SetViewAndLights(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
251 // viewParam->SetCurrentTargetPoint(targetPoint);
252 G4cout << "FLY CR("<< i << "):" << cameraPosition << G4endl;
253 viewVect.push_back(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
254 }
255
256// } else if (myCurveType == G4SplineTest) {
257 /*
258 This method is a inspire from a Bezier curve. The problem of the Bezier curve is that the path does not go straight between two waypoints.
259 This method add "stay straight" parameter which could be between 0 and 1 where the pass will follow exactly the line between the waypoints
260 Ex : stay straight = 50%
261 m1 = 3*(P1+P0)/2
262
263 Ex : stay straight = 0%
264 m1 = (P1+P0)/2
265
266 P1
267 / \
268 / \
269 a--x--b
270 / ° ° \
271 / ° ° \
272 m1 m2
273 / \
274 / \
275 / \
276 / \
277 P0 P2
278
279 */
280// G4Vector3D a;
281// G4Vector3D b;
282// G4Vector3D m1;
283// G4Vector3D m2;
284// G4Vector3D P0;
285// G4Vector3D P1;
286// G4Vector3D P2;
287// G4double stayStraight = 0;
288// G4double bezierSpeed = 0.4; // Spend 40% time in bezier curve (time between m1-m2 is 40% of time between P0-P1)
289//
290// G4Vector3D firstPoint;
291// G4Vector3D lastPoint;
292//
293// float nbBezierSteps = (stepPoints * bezierSpeed*(1-stayStraight)) * (2./spline.GetNumPoints());
294// float nbFirstSteps = ((stepPoints/2-nbBezierSteps/2) /(1+stayStraight)) * (2./spline.GetNumPoints());
295//
296// // First points
297// firstPoint = spline.GetPoint(0);
298// lastPoint = (firstPoint + spline.GetPoint(1))/2;
299//
300// for( float j=0; j<1; j+= 1/nbFirstSteps) {
301// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint) * j;
302// viewVect.push_back(pt);
303// G4cout << "FLY Bezier A1("<< viewVect.size()<< "):" << pt << G4endl;
304// }
305//
306// for (int i = 0; i < spline.GetNumPoints()-2; i++) {
307// P0 = spline.GetPoint(i);
308// P1 = spline.GetPoint(i+1);
309// P2 = spline.GetPoint(i+2);
310//
311// m1 = P1 - (P1-P0)*(1-stayStraight)/2;
312// m2 = P1 + (P2-P1)*(1-stayStraight)/2;
313//
314// // We have to get straight path from (middile of P0-P1) to (middile of P0-P1 + (dist P0-P1) * stayStraight/2)
315// if (stayStraight >0) {
316//
317// firstPoint = (P0 + P1)/2;
318// lastPoint = (P0 + P1)/2 + (P1-P0)*stayStraight/2;
319//
320// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
321// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
322// viewVect.push_back(pt);
323// G4cout << "FLY Bezier A2("<< viewVect.size()<< "):" << pt << G4endl;
324// }
325// }
326// // Compute Bezier curve
327// for( float delta = 0 ; delta < 1 ; delta += 1/nbBezierSteps)
328// {
329// // The Green Line
330// a = m1 + ( (P1 - m1) * delta );
331// b = P1 + ( (m2 - P1) * delta );
332//
333// // Final point
334// G4ThreeVector pt = a + ((b-a) * delta );
335// viewVect.push_back(pt);
336// G4cout << "FLY Bezier("<< viewVect.size()<< "):" << pt << G4endl;
337// }
338//
339// // We have to get straight path
340// if (stayStraight >0) {
341// firstPoint = (P1 + P2)/2 - (P2-P1)*stayStraight/2;
342// lastPoint = (P1 + P2)/2;
343//
344// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
345// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
346// viewVect.push_back(pt);
347// G4cout << "FLY Bezier B1("<< viewVect.size()<< "):" << pt << G4endl;
348// }
349// }
350// }
351//
352// // last points
353// firstPoint = spline.GetPoint(spline.GetNumPoints()-2);
354// lastPoint = spline.GetPoint(spline.GetNumPoints()-1);
355// for( float j=1; j>0; j-= 1/nbFirstSteps) {
356// G4ThreeVector pt = lastPoint - ((lastPoint-firstPoint)*((1-stayStraight)/2) * j );
357// viewVect.push_back(pt);
358// G4cout << "FLY Bezier B2("<< viewVect.size()<< "):" << pt << G4endl;
359// }
360// }
361 return viewVect;
362}
HepGeom::Vector3D< G4double > G4Vector3D
Definition: G4Vector3D.hh:34
G4GLOB_DLL std::ostream G4cout

References G4VViewer::G4Spline::AddSplinePoint(), G4cout, G4endl, G4VViewer::G4Spline::GetInterpolatedSplinePoint(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

◆ CreateFontLists()

void G4OpenGLXViewer::CreateFontLists ( )
protectedvirtualinherited

Reimplemented from G4OpenGLViewer.

Definition at line 356 of file G4OpenGLXViewer.cc.

357{
358 std::map<G4double,G4String> fonts; // G4VMarker screen size and font name.
359 fonts[10.] = "-adobe-courier-bold-r-normal--10-100-75-75-m-60-iso8859-1";
360 fonts[11.] = "-adobe-courier-bold-r-normal--11-80-100-100-m-60-iso8859-1";
361 fonts[12.] = "-adobe-courier-bold-r-normal--12-120-75-75-m-70-iso8859-1";
362 fonts[13.] = "fixed";
363 fonts[14.] = "-adobe-courier-bold-r-normal--14-100-100-100-m-90-iso8859-1";
364 fonts[17.] = "-adobe-courier-bold-r-normal--17-120-100-100-m-100-iso8859-1";
365 fonts[18.] = "-adobe-courier-bold-r-normal--18-180-75-75-m-110-iso8859-1";
366 fonts[20.] = "-adobe-courier-bold-r-normal--20-140-100-100-m-110-iso8859-1";
367 fonts[24.] = "-adobe-courier-bold-r-normal--24-240-75-75-m-150-iso8859-1";
368 fonts[25.] = "-adobe-courier-bold-r-normal--25-180-100-100-m-150-iso8859-1";
369 fonts[34.] = "-adobe-courier-bold-r-normal--34-240-100-100-m-200-iso8859-1";
370 std::map<G4double,G4String>::const_iterator i;
371 for (i = fonts.begin(); i != fonts.end(); ++i) {
372 XFontStruct* font_info = XLoadQueryFont(dpy, i->second);
373 if (!font_info) {
374 G4cerr <<
375 "G4OpenGLXViewer::CreateFontLists XLoadQueryFont failed for font\n "
376 << i->second
377 << G4endl;
378 continue;
379 }
380 G4int font_base = glGenLists(256);
381 if (!font_base) {
382 G4cerr <<
383 "G4OpenGLXViewer::CreateFontLists out of display lists for fonts."
384 << G4endl;
385 continue;
386 }
387 G4int first = font_info->min_char_or_byte2;
388 G4int last = font_info->max_char_or_byte2;
389 glXUseXFont(font_info->fid, first, last-first+1, font_base + first);
390 G4int width = font_info->max_bounds.width;
392 (this, font_base, i->first, i->second, width);
393 }
394}
int G4int
Definition: G4Types.hh:85
static void AddFontBase(G4VViewer *, G4int fontBase, G4double size, const G4String &fontName, G4int width)

References G4OpenGLFontBaseStore::AddFontBase(), G4OpenGLXViewer::dpy, G4cerr, and G4endl.

Referenced by G4OpenGLImmediateXViewer::Initialise(), and Initialise().

◆ CreateGLXContext()

void G4OpenGLXViewer::CreateGLXContext ( XVisualInfo *  vi)
protectedinherited

Definition at line 172 of file G4OpenGLXViewer.cc.

172 {
173
174 vi = v;
175// get window's attributes
176 if (!XGetWindowAttributes(dpy, XRootWindow (dpy, vi -> screen), &xwa)) {
177 fViewId = -1; // This flags an error.
178 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't return window attributes"
179 << G4endl;
180 return;
181 }
182
183// create the master GLX context
184 cxMaster = glXCreateContext (dpy, vi, 0, true);
185 if (!cxMaster) {
186 fViewId = -1; // This flags an error.
187 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't create context."
188 << G4endl;
189 return;
190 }
191
192// New stab at getting a colormap
193
194 Status status;
195 int i, numCmaps;
196
197 status = XmuLookupStandardColormap (dpy,
198 vi -> screen,
199 vi -> visualid,
200 vi -> depth,
201 XA_RGB_BEST_MAP,
202 False,
203 True);
204
205 if (status == 1) {
206 cmap = 0;
207 XStandardColormap* standardCmaps = XAllocStandardColormap ();
208 status = XGetRGBColormaps (dpy,
209 XRootWindow (dpy, vi -> screen),
210 &standardCmaps,
211 &numCmaps,
212 XA_RGB_BEST_MAP);
213 if (status == 1) {
214 for (i = 0; i < numCmaps; i++) {
215 if (standardCmaps[i].visualid == vi -> visualid) {
216 cmap = standardCmaps[i].colormap;
217 break;
218 }
219 }
220 }
221 XFree (standardCmaps);
222 if(cmap) {
224 G4cout << "Got standard cmap" << G4endl;
225 } else {
226 //if (G4VisManager::GetVerbosity() >= G4VisManager::errors)
227 // G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer failed to allocate a standard colormap."
228 // << G4endl;
229 cmap = XCreateColormap (dpy,
230 XRootWindow(dpy, vi -> screen),
231 vi -> visual,
232 AllocNone);
233 if(cmap) {
235 G4cout << "Created own cmap" << G4endl;
236 }
237 //G.Barrand : at end, we should do a XFreeColormap(dpy,cmap) when cmap is no more used.
238 }
239 } else {
240 cmap = XCreateColormap (dpy,
241 XRootWindow(dpy, vi -> screen),
242 vi -> visual,
243 AllocNone);
244 if(cmap) {
246 G4cout << "Created own cmap" << G4endl;
247 }
248 //G.Barrand : at end, we should do a XFreeColormap(dpy,cmap) when cmap is no more used.
249 }
250
251 if (!cmap) {
252 fViewId = -1; // This flags an error.
254 G4cout << "G4OpenGLXViewer::G4OpenGLXViewer failed to allocate a Colormap."
255 << G4endl;
256 return;
257 }
258
259}
static G4String Status(G4StepStatus stps)
XVisualInfo * vi
XWindowAttributes xwa
GLXContext cxMaster
static Verbosity GetVerbosity()

References G4OpenGLXViewer::cmap, G4VisManager::confirmations, G4OpenGLXViewer::cxMaster, G4OpenGLXViewer::dpy, G4VisManager::errors, G4VViewer::fViewId, G4cerr, G4cout, G4endl, G4VisManager::GetVerbosity(), Status(), G4OpenGLXViewer::vi, and G4OpenGLXViewer::xwa.

Referenced by G4OpenGLImmediateXmViewer::Initialise(), G4OpenGLImmediateXViewer::Initialise(), G4OpenGLStoredXmViewer::Initialise(), and Initialise().

◆ CreateMainWindow()

void G4OpenGLXViewer::CreateMainWindow ( )
protectedvirtualinherited

Reimplemented in G4OpenGLXmViewer.

Definition at line 261 of file G4OpenGLXViewer.cc.

261 {
262
263// create a window
264 swa.colormap = cmap;
265 swa.border_pixel = 0;
266 swa.event_mask = ExposureMask | ButtonPressMask | StructureNotifyMask;
267 swa.backing_store = WhenMapped;
268
269 // Window size and position...
270 size_hints = XAllocSizeHints();
271
273
274 G4int x_origin = fVP.GetWindowAbsoluteLocationHintX(DisplayWidth(dpy, vi -> screen));
275
276 // FIXME, screen size != window size on MAC, but I don't know have to get the menuBar
277 // size on MAC. L.Garnier 01/2009
278 G4int y_origin = fVP.GetWindowAbsoluteLocationHintY(DisplayHeight(dpy, vi -> screen));
279
280 size_hints->base_width = getWinWidth();
281 size_hints->base_height = getWinHeight();
282 size_hints->x = x_origin;
283 size_hints->y = y_origin;
285 size_hints->flags |= PSize | PPosition;
287 size_hints->flags |= PSize;
289 size_hints->flags |= PPosition;
290 }
292 G4cout << "Window name: " << fName << G4endl;
293 strncpy (charViewName, fName, 99); charViewName[99] = '\0';
294 char *window_name = charViewName;
295 char *icon_name = charViewName;
296 //char tmpatom[] = "XA_WM_NORMAL_HINTS";
297 wm_hints = XAllocWMHints();
298 class_hints = XAllocClassHint();
299
300 XStringListToTextProperty (&window_name, 1, &windowName);
301 XStringListToTextProperty (&icon_name, 1, &iconName);
302
303 wm_hints -> initial_state = NormalState;
304 wm_hints -> input = True;
306 wm_hints -> flags = StateHint | IconPixmapHint | InputHint;
307
308 class_hints -> res_name = NewString("G4OpenGL");
309 class_hints -> res_class = NewString("G4OpenGL");
310
311 win = XCreateWindow (dpy, XRootWindow (dpy, vi -> screen), x_origin,
312 y_origin, getWinWidth(), getWinHeight(), 0, vi -> depth,
313 InputOutput, vi -> visual,
314 CWBorderPixel | CWColormap |
315 CWEventMask | CWBackingStore,
316 &swa);
317
318 XSetWMProperties (dpy, win, &windowName, &iconName, 0, 0,
320
321// request X to Draw window on screen.
322 XMapWindow (dpy, win);
323
324// Wait for window to appear (wait for an "expose" event).
325 XIfEvent (dpy, &event, G4OpenGLXViewerWaitForNotify, (char*) win);
326
327// connect the context to a window
328 Bool success = glXMakeCurrent (dpy, win, cxMaster);
329 if (!success) {
330 fViewId = -1; // This flags an error.
331 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer failed to attach a GLX context."
332 << G4endl;
333 GLint error = GL_NO_ERROR;
334 while ((error = glGetError()) != GL_NO_ERROR) {
335 switch (error) {
336 case GL_INVALID_ENUM :
337 G4cout << "GL Error: GL_INVALID_ENUM" << G4endl;break;
338 case GL_INVALID_VALUE :
339 G4cout << "GL Error: GL_INVALID_VALUE" << G4endl;break;
340 case GL_INVALID_OPERATION :
341 G4cout << "GL Error: GL_INVALID_OPERATION" << G4endl;break;
342 case GL_OUT_OF_MEMORY :
343 G4cout << "GL Error: GL_OUT_OF_MEMORY" << G4endl;break;
344 case GL_STACK_UNDERFLOW :
345 G4cout << "GL Error: GL_STACK_UNDERFLOW" << G4endl;break;
346 case GL_STACK_OVERFLOW :
347 G4cout << "GL Error: GL_STACK_OVERFLOW" << G4endl;break;
348 default :
349 G4cout << "GL Error: " << error << G4endl;break;
350 }
351 }
352 return;
353 }
354}
static Bool G4OpenGLXViewerWaitForNotify(Display *, XEvent *e, char *arg)
#define NewString(str)
unsigned int getWinHeight() const
void ResizeWindow(unsigned int, unsigned int)
unsigned int getWinWidth() const
XTextProperty windowName
XClassHint * class_hints
XTextProperty iconName
XSizeHints * size_hints
XSetWindowAttributes swa
XWMHints * wm_hints
char charViewName[100]
G4String fName
Definition: G4VViewer.hh:217
bool IsWindowLocationHintY() const
G4int GetWindowAbsoluteLocationHintY(G4int) const
bool IsWindowLocationHintX() const
unsigned int GetWindowSizeHintX() const
bool IsWindowSizeHintX() const
G4int GetWindowAbsoluteLocationHintX(G4int) const
unsigned int GetWindowSizeHintY() const
static PROLOG_HANDLER error
Definition: xmlrole.cc:127

References G4OpenGLXViewer::charViewName, G4OpenGLXViewer::class_hints, G4OpenGLXViewer::cmap, G4VisManager::confirmations, G4OpenGLXViewer::cxMaster, G4OpenGLXViewer::dpy, error, G4OpenGLXViewer::event, G4VViewer::fName, G4VViewer::fViewId, G4VViewer::fVP, G4cerr, G4cout, G4endl, G4OpenGLXViewerWaitForNotify(), G4VisManager::GetVerbosity(), G4ViewParameters::GetWindowAbsoluteLocationHintX(), G4ViewParameters::GetWindowAbsoluteLocationHintY(), G4ViewParameters::GetWindowSizeHintX(), G4ViewParameters::GetWindowSizeHintY(), G4OpenGLViewer::getWinHeight(), G4OpenGLViewer::getWinWidth(), G4OpenGLXViewer::icon_pixmap, G4OpenGLXViewer::iconName, G4ViewParameters::IsWindowLocationHintX(), G4ViewParameters::IsWindowLocationHintY(), G4ViewParameters::IsWindowSizeHintX(), NewString, G4OpenGLViewer::ResizeWindow(), G4OpenGLXViewer::size_hints, G4OpenGLXViewer::swa, G4OpenGLXViewer::vi, G4OpenGLXViewer::win, G4OpenGLXViewer::windowName, and G4OpenGLXViewer::wm_hints.

Referenced by G4OpenGLImmediateXViewer::Initialise(), and Initialise().

◆ DisplayTimePOColourModification()

virtual void G4OpenGLStoredViewer::DisplayTimePOColourModification ( G4Colour ,
size_t   
)
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 56 of file G4OpenGLStoredViewer.hh.

57{}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ DrawDisplayLists()

void G4OpenGLStoredViewer::DrawDisplayLists ( )
protectedinherited

Definition at line 147 of file G4OpenGLStoredViewer.cc.

147 {
148
149 // We moved these from G4OpenGLViewer to G4ViewParamaters. To avoid
150 // editing many lines below we introduce these convenient aliases.
151#define CONVENIENT_DOUBLE_ALIAS(q) const G4double& f##q = fVP.Get##q();
152#define CONVENIENT_BOOL_ALIAS(q) const G4bool& f##q = fVP.Is##q();
153 CONVENIENT_DOUBLE_ALIAS(StartTime)
155 CONVENIENT_DOUBLE_ALIAS(FadeFactor)
156 CONVENIENT_BOOL_ALIAS(DisplayHeadTime)
157 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeX)
158 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeY)
159 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeSize)
160 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeRed)
161 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeGreen)
162 CONVENIENT_DOUBLE_ALIAS(DisplayHeadTimeBlue)
163 CONVENIENT_BOOL_ALIAS(DisplayLightFront)
164 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontX)
165 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontY)
166 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontZ)
167 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontT)
168 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontRed)
169 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontGreen)
170 CONVENIENT_DOUBLE_ALIAS(DisplayLightFrontBlue)
171
172 const G4Planes& cutaways = fVP.GetCutawayPlanes();
173 G4bool cutawayUnion = fVP.IsCutaway() &&
175 const size_t nCutaways = cutawayUnion? cutaways.size(): 1;
176 G4int iPass = 1;
177 G4bool secondPassForTransparencyRequested = false;
178 G4bool thirdPassForNonHiddenMarkersRequested = false;
179 fDepthTestEnable = true;
180 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
181 do {
182 for (size_t iCutaway = 0; iCutaway < nCutaways; ++iCutaway) {
183
184 if (cutawayUnion) {
185 double a[4];
186 a[0] = cutaways[iCutaway].a();
187 a[1] = cutaways[iCutaway].b();
188 a[2] = cutaways[iCutaway].c();
189 a[3] = cutaways[iCutaway].d();
190 glClipPlane (GL_CLIP_PLANE2, a);
191 glEnable (GL_CLIP_PLANE2);
192 }
193
194 G4bool isPicking = fVP.IsPicking();
195
196 for (size_t iPO = 0;
197 iPO < fG4OpenGLStoredSceneHandler.fPOList.size(); ++iPO) {
198 if (POSelected(iPO)) {
201 G4Colour c = po.fColour;
203 const G4bool isTransparent = c.GetAlpha() < 1.;
204 if ( iPass == 1) {
205 if (isTransparent && transparency_enabled) {
206 secondPassForTransparencyRequested = true;
207 continue;
208 }
210 thirdPassForNonHiddenMarkersRequested = true;
211 continue;
212 }
213 } else if (iPass == 2) { // Second pass for transparency.
214 if (!isTransparent) {
215 continue;
216 }
217 } else { // Third pass for non-hidden markers
218 if (!po.fMarkerOrPolyline) {
219 continue;
220 }
221 }
222 if (isPicking) glLoadName(po.fPickName);
224 glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha());
225 } else {
226 glColor3d(c.GetRed(),c.GetGreen(),c.GetBlue());
227 }
229 if (fDepthTestEnable !=false) {
230 glDisable (GL_DEPTH_TEST);
231 fDepthTestEnable = false;
232 }
233 } else {
234 if (fDepthTestEnable !=true) {
235 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
236 fDepthTestEnable = true;
237 }
238 }
239 if (po.fpG4TextPlus) {
240 if (po.fpG4TextPlus->fProcessing2D) {
241 glMatrixMode (GL_PROJECTION);
242 glPushMatrix();
243 glLoadIdentity();
244 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
245 glMatrixMode (GL_MODELVIEW);
246 glPushMatrix();
247 glLoadIdentity();
249 glMultMatrixd (oglt.GetGLMatrix ());
250 // This text is from a PODL. We don't want to create a new PODL.
252 } else {
253 glPushMatrix();
255 glMultMatrixd (oglt.GetGLMatrix ());
256 // This text is from a PODL. We don't want to create a new PODL.
258 glPopMatrix();
259 }
260
261 if (po.fpG4TextPlus->fProcessing2D) {
262 glMatrixMode (GL_PROJECTION);
263 glPopMatrix();
264 glMatrixMode (GL_MODELVIEW);
265 glPopMatrix();
266 }
267 } else {
268 glPushMatrix();
270 glMultMatrixd (oglt.GetGLMatrix ());
271 glCallList (po.fDisplayListId);
272 glPopMatrix();
273 }
274 }
275 }
276
277 G4Transform3D lastMatrixTransform;
278 G4bool first = true;
279
280 for (size_t iTO = 0;
281 iTO < fG4OpenGLStoredSceneHandler.fTOList.size(); ++iTO) {
282 if (TOSelected(iTO)) {
285 const G4Colour& c = to.fColour;
286 const G4bool isTransparent = c.GetAlpha() < 1.;
287 if ( iPass == 1) {
288 if (isTransparent && transparency_enabled) {
289 secondPassForTransparencyRequested = true;
290 continue;
291 }
293 thirdPassForNonHiddenMarkersRequested = true;
294 continue;
295 }
296 } else if (iPass == 2) { // Second pass for transparency.
297 if (!isTransparent) {
298 continue;
299 }
300 } else { // Third pass for non-hidden markers
301 if (!to.fMarkerOrPolyline) {
302 continue;
303 }
304 }
306 if (fDepthTestEnable !=false) {
307 glDisable (GL_DEPTH_TEST);
308 fDepthTestEnable = false;
309 }
310 } else {
311 if (fDepthTestEnable !=true) {
312 glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);
313 fDepthTestEnable = true;
314 }
315 }
316 if (to.fEndTime >= fStartTime && to.fStartTime <= fEndTime) {
317 if (fVP.IsPicking()) glLoadName(to.fPickName);
318 if (to.fpG4TextPlus) {
319 if (to.fpG4TextPlus->fProcessing2D) {
320 glMatrixMode (GL_PROJECTION);
321 glPushMatrix();
322 glLoadIdentity();
323 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
324 glMatrixMode (GL_MODELVIEW);
325 glPushMatrix();
326 glLoadIdentity();
327 }
329 glMultMatrixd (oglt.GetGLMatrix ());
330 // This text is from a TODL. We don't want to create a new TODL.
332 if (to.fpG4TextPlus->fProcessing2D) {
333 glMatrixMode (GL_PROJECTION);
334 glPopMatrix();
335 glMatrixMode (GL_MODELVIEW);
336 glPopMatrix();
337 }
338 } else {
339 if (to.fTransform != lastMatrixTransform) {
340 if (! first) {
341 glPopMatrix();
342 }
343 first = false;
344 glPushMatrix();
346 glMultMatrixd (oglt.GetGLMatrix ());
347 }
348 const G4Colour& cc = to.fColour;
349 if (fFadeFactor > 0. && to.fEndTime < fEndTime) {
350 // Brightness scaling factor
351 G4double bsf = 1. - fFadeFactor *
352 ((fEndTime - to.fEndTime) / (fEndTime - fStartTime));
353 const G4Colour& bg = fVP.GetBackgroundColour();
355 glColor4d
356 (bsf * cc.GetRed() + (1. - bsf) * bg.GetRed(),
357 bsf * cc.GetGreen() + (1. - bsf) * bg.GetGreen(),
358 bsf * cc.GetBlue() + (1. - bsf) * bg.GetBlue(),
359 bsf * cc.GetAlpha() + (1. - bsf) * bg.GetAlpha());
360 } else {
361 glColor3d
362 (bsf * cc.GetRed() + (1. - bsf) * bg.GetRed(),
363 bsf * cc.GetGreen() + (1. - bsf) * bg.GetGreen(),
364 bsf * cc.GetBlue() + (1. - bsf) * bg.GetBlue());
365 }
366 } else {
368 glColor4d(cc.GetRed(),cc.GetGreen(),cc.GetBlue(),cc.GetAlpha());
369 } else {
370 glColor3d(cc.GetRed(),cc.GetGreen(),cc.GetBlue());
371 }
372 }
373 glCallList (to.fDisplayListId);
374 }
375 if (to.fTransform != lastMatrixTransform) {
376 lastMatrixTransform = to.fTransform;
377 }
378 }
379 }
380 }
381 if (! first) {
382 glPopMatrix();
383 }
384
385 if (cutawayUnion) glDisable (GL_CLIP_PLANE2);
386 } // iCutaway
387
388 if (iPass == 2) secondPassForTransparencyRequested = false; // Done.
389 if (iPass == 3) thirdPassForNonHiddenMarkersRequested = false; // Done.
390
391 if (secondPassForTransparencyRequested) iPass = 2;
392 else if (thirdPassForNonHiddenMarkersRequested) iPass = 3;
393 else break;
394
395 } while (true);
396
397 // Display time at "head" of time range, which is fEndTime...
398 if (fDisplayHeadTime && fEndTime < G4VisAttributes::fVeryLongTime) {
399 glMatrixMode (GL_PROJECTION);
400 glPushMatrix();
401 glLoadIdentity();
402 g4GlOrtho (-1., 1., -1., 1., -G4OPENGL_FLT_BIG, G4OPENGL_FLT_BIG);
403 glMatrixMode (GL_MODELVIEW);
404 glPushMatrix();
405 glLoadIdentity();
406 G4Text headTimeText(G4BestUnit(fEndTime,"Time"),
407 G4Point3D(fDisplayHeadTimeX, fDisplayHeadTimeY, 0.));
408 headTimeText.SetScreenSize(fDisplayHeadTimeSize);
410 (fDisplayHeadTimeRed,
411 fDisplayHeadTimeGreen,
412 fDisplayHeadTimeBlue));
413 headTimeText.SetVisAttributes(&visAtts);
414 AddPrimitiveForASingleFrame(headTimeText);
415 glMatrixMode (GL_PROJECTION);
416 glPopMatrix();
417 glMatrixMode (GL_MODELVIEW);
418 glPopMatrix();
419 }
420
421 // Display light front...
422 if (fDisplayLightFront && fEndTime < G4VisAttributes::fVeryLongTime) {
423 G4double lightFrontRadius = (fEndTime - fDisplayLightFrontT) * c_light;
424 if (lightFrontRadius > 0.) {
425 G4Point3D lightFrontCentre(fDisplayLightFrontX, fDisplayLightFrontY, fDisplayLightFrontZ);
426 G4Point3D circleCentre = lightFrontCentre;
427 G4double circleRadius = lightFrontRadius;
428 if (fVP.GetFieldHalfAngle() > 0.) {
429 // Perspective view. Find horizon centre and radius...
433 if(sceneRadius <= 0.) sceneRadius = 1.;
434 G4double cameraDistance = fVP.GetCameraDistance(sceneRadius);
435 G4Point3D cameraPosition = targetPoint + cameraDistance * fVP.GetViewpointDirection().unit();
436 G4Vector3D lightFrontToCameraDirection = cameraPosition - lightFrontCentre;
437 G4double lightFrontCentreDistance = lightFrontToCameraDirection.mag();
438 /*
439 G4cout << "cameraPosition: " << cameraPosition
440 << ", lightFrontCentre: " << lightFrontCentre
441 << ", lightFrontRadius: " << lightFrontRadius
442 << ", lightFrontCentreDistance: " << lightFrontCentreDistance
443 << ", dot: " << lightFrontToCameraDirection * fVP.GetViewpointDirection()
444 << G4endl;
445 */
446 if (lightFrontToCameraDirection * fVP.GetViewpointDirection() > 0. && lightFrontRadius < lightFrontCentreDistance) {
447 // Light front in front of camera...
448 G4double sineHorizonAngle = lightFrontRadius / lightFrontCentreDistance;
449 circleCentre = lightFrontCentre + (lightFrontRadius * sineHorizonAngle) * lightFrontToCameraDirection.unit();
450 circleRadius = lightFrontRadius * std::sqrt(1. - std::pow(sineHorizonAngle, 2));
451 /*
452 G4cout << "sineHorizonAngle: " << sineHorizonAngle
453 << ", circleCentre: " << circleCentre
454 << ", circleRadius: " << circleRadius
455 << G4endl;
456 */
457 } else {
458 circleRadius = -1.;
459 }
460 }
461 if (circleRadius > 0.) {
462 G4Circle lightFront(circleCentre);
463 lightFront.SetWorldRadius(circleRadius);
465 (fDisplayLightFrontRed,
466 fDisplayLightFrontGreen,
467 fDisplayLightFrontBlue));
468 lightFront.SetVisAttributes(visAtts);
469 AddPrimitiveForASingleFrame(lightFront);
470 }
471 }
472 }
473}
#define CONVENIENT_BOOL_ALIAS(q)
#define CONVENIENT_DOUBLE_ALIAS(q)
#define G4OPENGL_FLT_BIG
Definition: G4OpenGL.hh:89
HepGeom::Point3D< G4double > G4Point3D
Definition: G4Point3D.hh:34
#define G4BestUnit(a, b)
double G4double
Definition: G4Types.hh:83
std::vector< G4Plane3D > G4Planes
G4double GetAlpha() const
Definition: G4Colour.hh:155
virtual G4bool TOSelected(size_t)
virtual G4bool POSelected(size_t)
virtual void DisplayTimePOColourModification(G4Colour &, size_t)
void AddPrimitiveForASingleFrame(const G4Text &text)
G4bool transparency_enabled
void g4GlOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
const G4VisExtent & GetExtent() const
const G4Point3D & GetStandardTargetPoint() const
Definition: G4Text.hh:72
G4Scene * GetScene() const
G4VSceneHandler & fSceneHandler
Definition: G4VViewer.hh:215
CutawayMode GetCutawayMode() const
G4double GetCameraDistance(G4double radius) const
G4bool IsCutaway() const
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFieldHalfAngle() const
const G4Planes & GetCutawayPlanes() const
static constexpr G4double fVeryLongTime
G4double GetExtentRadius() const
Definition: G4VisExtent.cc:75
BasicVector3D< T > unit() const
float c_light
Definition: hepunit.py:256

References G4OpenGLStoredViewer::AddPrimitiveForASingleFrame(), source.hepunit::c_light, CONVENIENT_BOOL_ALIAS, CONVENIENT_DOUBLE_ALIAS, G4ViewParameters::cutawayUnion, G4OpenGLStoredViewer::DisplayTimePOColourModification(), G4OpenGLStoredSceneHandler::PO::fColour, G4OpenGLStoredSceneHandler::TO::fColour, G4OpenGLStoredViewer::fDepthTestEnable, G4OpenGLStoredSceneHandler::PO::fDisplayListId, G4OpenGLStoredSceneHandler::TO::fDisplayListId, G4OpenGLStoredSceneHandler::TO::fEndTime, G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, G4OpenGLStoredSceneHandler::G4TextPlus::fG4Text, G4OpenGLStoredSceneHandler::PO::fMarkerOrPolyline, G4OpenGLStoredSceneHandler::TO::fMarkerOrPolyline, G4OpenGLStoredSceneHandler::PO::fpG4TextPlus, G4OpenGLStoredSceneHandler::TO::fpG4TextPlus, G4OpenGLStoredSceneHandler::PO::fPickName, G4OpenGLStoredSceneHandler::TO::fPickName, G4OpenGLStoredSceneHandler::fPOList, G4OpenGLStoredSceneHandler::G4TextPlus::fProcessing2D, G4VViewer::fSceneHandler, G4OpenGLStoredSceneHandler::TO::fStartTime, G4OpenGLStoredSceneHandler::fTOList, G4OpenGLStoredSceneHandler::PO::fTransform, G4OpenGLStoredSceneHandler::TO::fTransform, G4VisAttributes::fVeryLongTime, G4VViewer::fVP, G4BestUnit, G4OpenGLViewer::g4GlOrtho(), G4OPENGL_FLT_BIG, G4Colour::GetAlpha(), G4ViewParameters::GetBackgroundColour(), G4Colour::GetBlue(), G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetCutawayPlanes(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFieldHalfAngle(), G4OpenGLTransform3D::GetGLMatrix(), G4Colour::GetGreen(), G4Colour::GetRed(), G4VSceneHandler::GetScene(), G4Scene::GetStandardTargetPoint(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::IsCutaway(), G4ViewParameters::IsMarkerNotHidden(), G4ViewParameters::IsPicking(), HepGeom::BasicVector3D< T >::mag(), G4OpenGLStoredViewer::POSelected(), G4VMarker::SetScreenSize(), G4Visible::SetVisAttributes(), G4VMarker::SetWorldRadius(), G4OpenGLStoredViewer::TOSelected(), G4OpenGLViewer::transparency_enabled, and HepGeom::BasicVector3D< T >::unit().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and DrawView().

◆ DrawText()

void G4OpenGLXViewer::DrawText ( const G4Text g4text)
virtualinherited

Reimplemented from G4OpenGLViewer.

Definition at line 396 of file G4OpenGLXViewer.cc.

397{
398 if (isGl2psWriting()) {
399
401
402 } else {
403
405 G4double size = fSceneHandler.GetMarkerSize(g4text,sizeType);
406
407 const G4OpenGLFontBaseStore::FontInfo& fontInfo =
409 if (fontInfo.fFontBase < 0) {
410 static G4int callCount = 0;
411 ++callCount;
412 //if (callCount <= 10 || callCount%100 == 0) {
413 if (callCount <= 1) {
414 G4cout <<
415 "G4OpenGLXViewer::DrawText: No fonts available for \""
416 << fName <<
417 "\"\n Called with "
418 << g4text
419 << G4endl;
420 }
421 return;
422 }
423
424 const G4Colour& c = fSceneHandler.GetTextColour(g4text);
425 glColor4d(c.GetRed(),c.GetGreen(),c.GetBlue(),c.GetAlpha());
426
427 G4Point3D position = g4text.GetPosition();
428
429 G4String textString = g4text.GetText();
430 const char* textCString = textString.c_str();
431
432 // Set position for raster-style drawers (X, Xm)
433 glRasterPos3d(position.x(),position.y(),position.z());
434
435 glPushAttrib(GL_LIST_BIT);
436
437 // Calculate move for centre and right adjustment
438 G4double span = textString.size() * fontInfo.fWidth;
439 G4double xmove = 0., ymove = 0.;
440 switch (g4text.GetLayout()) {
441 case G4Text::left: break;
442 case G4Text::centre: xmove -= span / 2.; break;
443 case G4Text::right: xmove -= span;
444 }
445
446 //Add offsets
447 xmove += g4text.GetXOffset();
448 ymove += g4text.GetYOffset();
449
450 // Do move
451 glBitmap(0,0,0,0,xmove,ymove,0);
452
453 // Write characters
454 glListBase(fontInfo.fFontBase);
455 glCallLists(strlen(textCString),GL_UNSIGNED_BYTE,(GLubyte*)textCString);
456 glPopAttrib();
457 }
458}
static const FontInfo & GetFontInfo(G4VViewer *, G4double size)
virtual void DrawText(const G4Text &)
Layout GetLayout() const
G4double GetYOffset() const
G4double GetXOffset() const
G4String GetText() const
@ centre
Definition: G4Text.hh:76
@ right
Definition: G4Text.hh:76
@ left
Definition: G4Text.hh:76
G4Point3D GetPosition() const
const G4Colour & GetTextColour(const G4Text &)
G4double GetMarkerSize(const G4VMarker &, MarkerSizeType &)

References G4Text::centre, G4OpenGLViewer::DrawText(), G4OpenGLFontBaseStore::FontInfo::fFontBase, G4VViewer::fName, G4VViewer::fSceneHandler, G4OpenGLFontBaseStore::FontInfo::fWidth, G4cout, G4endl, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4OpenGLFontBaseStore::GetFontInfo(), G4Colour::GetGreen(), G4Text::GetLayout(), G4VSceneHandler::GetMarkerSize(), G4VMarker::GetPosition(), G4Colour::GetRed(), G4Text::GetText(), G4VSceneHandler::GetTextColour(), G4Text::GetXOffset(), G4Text::GetYOffset(), G4OpenGLViewer::isGl2psWriting(), G4Text::left, and G4Text::right.

◆ DrawView()

void G4OpenGLStoredXViewer::DrawView ( )
virtual

Implements G4VViewer.

Definition at line 73 of file G4OpenGLStoredXViewer.cc.

73 {
74
75#ifdef G4DEBUG_VIS_OGL
76 printf("G4OpenGLStoredXViewer::DrawView\n");
77#endif
78
80
81 // See if things have changed from last time and remake if necessary...
82 // The fNeedKernelVisit flag might have been set by the user in
83 // /vis/viewer/rebuild, but if not, make decision and set flag only
84 // if necessary...
86 fLastVP = fVP;
87 G4bool kernelVisitWasNeeded = fNeedKernelVisit; // Keep (ProcessView resets).
88 ProcessView ();
89
91
94#ifdef G4DEBUG_VIS_OGL
95 printf("G4OpenGLStoredXViewer::DrawView flush \n");
96#endif
97 glFlush ();
98
100
102
103 } else {
104
105 if (!kernelVisitWasNeeded) {
106#ifdef G4DEBUG_VIS_OGL
107 printf("G4OpenGLStoredXViewer::DrawView NO need kernel visit\n");
108#endif
110
111 } else {
112
113#ifdef G4DEBUG_VIS_OGL
114 printf("G4OpenGLStoredXViewer::DrawView NEED kernel visit\n");
115#endif
116 // However, union cutaways are implemented in DrawDisplayLists, so make
117 // an extra pass...
118 if (fVP.IsCutaway() &&
120 ClearView();
122 } else { // ADD TO AVOID KernelVisit=1 and nothing to display
124 }
125 }
126 }
127
128 FinishView ();
129
130}
void HaloingSecondPass()
G4bool fNeedKernelVisit
Definition: G4VViewer.hh:224
const G4ViewParameters & GetViewParameters() const
void ProcessView()
Definition: G4VViewer.cc:105

References G4OpenGLViewer::ClearView(), G4ViewParameters::cutawayUnion, G4OpenGLStoredViewer::DrawDisplayLists(), FinishView(), G4OpenGLStoredViewer::fLastVP, G4VViewer::fNeedKernelVisit, G4VViewer::fVP, G4ViewParameters::GetCutawayMode(), G4ViewParameters::GetDrawingStyle(), G4VViewer::GetViewParameters(), G4OpenGLViewer::haloing_enabled, G4OpenGLViewer::HaloingFirstPass(), G4OpenGLViewer::HaloingSecondPass(), G4ViewParameters::hlr, G4ViewParameters::IsCutaway(), G4OpenGLStoredViewer::KernelVisitDecision(), and G4VViewer::ProcessView().

◆ exportImage()

bool G4OpenGLViewer::exportImage ( std::string  name = "",
int  width = -1,
int  height = -1 
)
virtualinherited

Export image with the given name with width and height Several cases : If name is "", filename will have the default value If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). Will also add an incremented suffix at the end of the file

Reimplemented in G4OpenGLQtViewer.

Definition at line 827 of file G4OpenGLViewer.cc.

827 {
828
829 if (! setExportFilename(name)) {
830 return false;
831 }
832
833 if ((width != -1) && (height != -1)) {
834 setExportSize(width, height);
835 }
836
837 if (fExportImageFormat == "eps") {
839 } else if (fExportImageFormat == "ps") {
841 } else if (fExportImageFormat == "svg") {
843 } else if (fExportImageFormat == "pdf") {
845 } else {
846 setExportImageFormat(fExportImageFormat,true); // will display a message if this format is not correct for the current viewer
847 return false;
848 }
849
850 bool res;
851
852 // Change the LC_NUMERIC value in order to have "." separtor and not ","
853 // This case is only useful for French, Canadien...
854 size_t len = strlen(setlocale(LC_NUMERIC,NULL));
855 char* oldLocale = (char*)(malloc(len+1));
856 if(oldLocale!=NULL) strncpy(oldLocale,setlocale(LC_NUMERIC,NULL),len);
857 setlocale(LC_NUMERIC,"C");
858
859 if (((fExportImageFormat == "eps") || (fExportImageFormat == "ps")) && (!fVectoredPs)) {
860 res = printNonVectoredEPS();
861 } else {
862 res = printVectoredEPS();
863 }
864
865 // restore the local
866 if (oldLocale) {
867 setlocale(LC_NUMERIC,oldLocale);
868 free(oldLocale);
869 }
870
871 if (res == false) {
872 G4cerr << "Error saving file... " << getRealPrintFilename().c_str() << G4endl;
873 } else {
874 G4cout << "File " << getRealPrintFilename().c_str() << " size: " << getRealExportWidth() << "x" << getRealExportHeight() << " has been saved " << G4endl;
875
876 // increment index if necessary
877 if ( fExportFilenameIndex != -1) {
879 }
880 }
881
882 return res;
883}
void setExportImageFormat(unsigned int)
G4int getRealExportHeight()
bool setExportImageFormat(std::string format, bool quiet=false)
std::string fExportImageFormat
bool setExportFilename(G4String name, G4bool inc=true)
bool printNonVectoredEPS()
void setExportSize(G4int, G4int)
G4int getRealExportWidth()
std::string getRealPrintFilename()
#define GL2PS_SVG
Definition: gl2ps.h:133
#define GL2PS_EPS
Definition: gl2ps.h:130
#define GL2PS_PDF
Definition: gl2ps.h:132
#define GL2PS_PS
Definition: gl2ps.h:129

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fGL2PSAction, free, G4OpenGLViewer::fVectoredPs, G4cerr, G4cout, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), GL2PS_EPS, GL2PS_PDF, GL2PS_PS, GL2PS_SVG, G4InuclParticleNames::name(), G4OpenGLViewer::printNonVectoredEPS(), G4OpenGLViewer::printVectoredEPS(), G4OpenGLViewer::setExportFilename(), G4OpenGLViewer::setExportImageFormat(), G4OpenGL2PSAction::setExportImageFormat(), and G4OpenGLViewer::setExportSize().

Referenced by G4OpenGLQtViewer::exportImage(), G4OpenGLXmViewer::print_callback(), and G4OpenGLViewerMessenger::SetNewValue().

◆ FinishView()

void G4OpenGLStoredXViewer::FinishView ( void  )
virtual

Reimplemented from G4VViewer.

Definition at line 132 of file G4OpenGLStoredXViewer.cc.

132 {
133#ifdef G4DEBUG_VIS_OGL
134 printf("G4OpenGLStoredXViewer::FinishView\n");
135#endif
136
137// glXWaitGL (); //Wait for effects of all previous OpenGL commands to
138 //be propagated before progressing.
139// JA: Commented out July 2021 - slows rendering down in some cases and I
140// don't see any adverse effects.
141
142#ifdef G4DEBUG_VIS_OGL
143 printf("G4OpenGLStoredXViewer::FinishView flush \n");
144#endif
145 glFlush (); //FIXME
146
147 GLint renderMode;
148 glGetIntegerv(GL_RENDER_MODE, &renderMode);
149 if (renderMode == GL_RENDER) glXSwapBuffers (dpy, win);
150}

References G4OpenGLXViewer::dpy, and G4OpenGLXViewer::win.

Referenced by DrawView().

◆ g4GlFrustum()

void G4OpenGLViewer::g4GlFrustum ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1467 of file G4OpenGLViewer.cc.

1467 {
1468 // glFrustum (left, right, bottom, top, near, far);
1469
1470 GLdouble deltaX = right - left;
1471 GLdouble deltaY = top - bottom;
1472 GLdouble deltaZ = zFar - zNear;
1473
1474 GLdouble a = 2.0f * zNear / deltaX;
1475 GLdouble b = 2.0f * zNear / deltaY;
1476 GLdouble c = (right + left) / deltaX;
1477 GLdouble d = (top + bottom) / deltaY;
1478 GLdouble e = -(zFar + zNear) / (zFar - zNear);
1479 GLdouble f = -2.0f * zFar * zNear / deltaZ;
1480
1481 GLdouble proj[16] = {
1482 a, 0, 0, 0,
1483 0, b, 0, 0,
1484 c, d, e, -1.0f,
1485 0, 0, f, 0
1486 };
1487
1488 glMultMatrixd(proj);
1489
1490}

Referenced by G4OpenGLViewer::SetView().

◆ g4GlOrtho()

void G4OpenGLViewer::g4GlOrtho ( GLdouble  left,
GLdouble  right,
GLdouble  bottom,
GLdouble  top,
GLdouble  near,
GLdouble  far 
)
protectedinherited

Definition at line 1445 of file G4OpenGLViewer.cc.

1445 {
1446 // glOrtho (left, right, bottom, top, near, far);
1447
1448 GLdouble a = 2.0 / (right - left);
1449 GLdouble b = 2.0 / (top - bottom);
1450 GLdouble c = -2.0 / (zFar - zNear);
1451
1452 GLdouble tx = - (right + left)/(right - left);
1453 GLdouble ty = - (top + bottom)/(top - bottom);
1454 GLdouble tz = - (zFar + zNear)/(zFar - zNear);
1455
1456 GLdouble ortho[16] = {
1457 a, 0, 0, 0,
1458 0, b, 0, 0,
1459 0, 0, c, 0,
1460 tx, ty, tz, 1
1461 };
1462 glMultMatrixd(ortho);
1463
1464}

Referenced by G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLImmediateSceneHandler::BeginPrimitives2D(), G4OpenGLStoredViewer::DrawDisplayLists(), and G4OpenGLViewer::SetView().

◆ g4GluLookAt()

void G4OpenGLViewer::g4GluLookAt ( GLdouble  eyex,
GLdouble  eyey,
GLdouble  eyez,
GLdouble  centerx,
GLdouble  centery,
GLdouble  centerz,
GLdouble  upx,
GLdouble  upy,
GLdouble  upz 
)
protectedinherited

Definition at line 1365 of file G4OpenGLViewer.cc.

1369{
1370 GLdouble mat[16];
1371 GLdouble x[3], y[3], z[3];
1372 GLdouble mag;
1373
1374 /* Make rotation matrix */
1375
1376 /* Z vector */
1377 z[0] = eyex - centerx;
1378 z[1] = eyey - centery;
1379 z[2] = eyez - centerz;
1380 mag = std::sqrt(z[0] * z[0] + z[1] * z[1] + z[2] * z[2]);
1381 if (mag) { /* mpichler, 19950515 */
1382 z[0] /= mag;
1383 z[1] /= mag;
1384 z[2] /= mag;
1385 }
1386
1387 /* Y vector */
1388 y[0] = upx;
1389 y[1] = upy;
1390 y[2] = upz;
1391
1392 /* X vector = Y cross Z */
1393 x[0] = y[1] * z[2] - y[2] * z[1];
1394 x[1] = -y[0] * z[2] + y[2] * z[0];
1395 x[2] = y[0] * z[1] - y[1] * z[0];
1396
1397 /* Recompute Y = Z cross X */
1398 y[0] = z[1] * x[2] - z[2] * x[1];
1399 y[1] = -z[0] * x[2] + z[2] * x[0];
1400 y[2] = z[0] * x[1] - z[1] * x[0];
1401
1402 /* mpichler, 19950515 */
1403 /* cross product gives area of parallelogram, which is < 1.0 for
1404 * non-perpendicular unit-length vectors; so normalize x, y here
1405 */
1406
1407 mag = std::sqrt(x[0] * x[0] + x[1] * x[1] + x[2] * x[2]);
1408 if (mag) {
1409 x[0] /= mag;
1410 x[1] /= mag;
1411 x[2] /= mag;
1412 }
1413
1414 mag = std::sqrt(y[0] * y[0] + y[1] * y[1] + y[2] * y[2]);
1415 if (mag) {
1416 y[0] /= mag;
1417 y[1] /= mag;
1418 y[2] /= mag;
1419 }
1420
1421#define M(row,col) mat[col*4+row]
1422 M(0, 0) = x[0];
1423 M(0, 1) = x[1];
1424 M(0, 2) = x[2];
1425 M(0, 3) = 0.0;
1426 M(1, 0) = y[0];
1427 M(1, 1) = y[1];
1428 M(1, 2) = y[2];
1429 M(1, 3) = 0.0;
1430 M(2, 0) = z[0];
1431 M(2, 1) = z[1];
1432 M(2, 2) = z[2];
1433 M(2, 3) = 0.0;
1434 M(3, 0) = 0.0;
1435 M(3, 1) = 0.0;
1436 M(3, 2) = 0.0;
1437 M(3, 3) = 1.0;
1438#undef M
1439 glMultMatrixd(mat);
1440
1441 /* Translate Eye to Origin */
1442 glTranslated(-eyex, -eyey, -eyez);
1443}
#define M(row, col)

References M.

Referenced by G4OpenGLViewer::SetView().

◆ g4GluPickMatrix()

void G4OpenGLViewer::g4GluPickMatrix ( GLdouble  x,
GLdouble  y,
GLdouble  width,
GLdouble  height,
GLint  viewport[4] 
)
protectedinherited

Definition at line 1323 of file G4OpenGLViewer.cc.

1325 {
1326 GLdouble mat[16];
1327 GLdouble sx, sy;
1328 GLdouble tx, ty;
1329
1330 sx = viewport[2] / width;
1331 sy = viewport[3] / height;
1332 tx = (viewport[2] + 2.0 * (viewport[0] - x)) / width;
1333 ty = (viewport[3] + 2.0 * (viewport[1] - y)) / height;
1334
1335#define M(row, col) mat[col*4+row]
1336 M(0, 0) = sx;
1337 M(0, 1) = 0.0;
1338 M(0, 2) = 0.0;
1339 M(0, 3) = tx;
1340 M(1, 0) = 0.0;
1341 M(1, 1) = sy;
1342 M(1, 2) = 0.0;
1343 M(1, 3) = ty;
1344 M(2, 0) = 0.0;
1345 M(2, 1) = 0.0;
1346 M(2, 2) = 1.0;
1347 M(2, 3) = 0.0;
1348 M(3, 0) = 0.0;
1349 M(3, 1) = 0.0;
1350 M(3, 2) = 0.0;
1351 M(3, 3) = 1.0;
1352#undef M
1353
1354 glMultMatrixd(mat);
1355}

References M.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ GetApplicableVisAttributes()

const G4VisAttributes * G4VViewer::GetApplicableVisAttributes ( const G4VisAttributes ) const
inherited

◆ GetDefaultViewParameters()

const G4ViewParameters & G4VViewer::GetDefaultViewParameters ( ) const
inherited

◆ GetName()

const G4String & G4VViewer::GetName ( ) const
inherited

◆ GetPickDetails()

const std::vector< G4OpenGLViewerPickMap * > & G4OpenGLViewer::GetPickDetails ( GLdouble  x,
GLdouble  y 
)
protectedinherited

Definition at line 488 of file G4OpenGLViewer.cc.

489{
490 static std::vector < G4OpenGLViewerPickMap* > pickMapVector;
491 for (auto pickMap: pickMapVector) {
492 delete pickMap;
493 }
494 pickMapVector.clear();
495
496 const G4int BUFSIZE = 512;
497 GLuint selectBuffer[BUFSIZE];
498 glSelectBuffer(BUFSIZE, selectBuffer);
499 glRenderMode(GL_SELECT);
500 glInitNames();
501 glPushName(0);
502 glMatrixMode(GL_PROJECTION);
503 G4double currentProjectionMatrix[16];
504 glGetDoublev(GL_PROJECTION_MATRIX, currentProjectionMatrix);
505 glPushMatrix();
506 glLoadIdentity();
507 GLint viewport[4];
508 glGetIntegerv(GL_VIEWPORT, viewport);
509/* G4cout
510 << "viewport, x,y: "
511 << viewport[0] << ',' << viewport[1] << ',' << viewport[2] << ',' << viewport[3]
512 << ", " << x << ',' << y
513 << G4endl;
514*/
515 fIsGettingPickInfos = true;
516 // Define 5x5 pixel pick area
517 g4GluPickMatrix(x, viewport[3] - y, 5., 5., viewport);
518 glMultMatrixd(currentProjectionMatrix);
519 glMatrixMode(GL_MODELVIEW);
520 DrawView();
521 GLint hits = glRenderMode(GL_RENDER);
522 fIsGettingPickInfos = false;
523 if (hits < 0) {
524 G4cout << "Too many hits. Zoom in to reduce overlaps." << G4endl;
525 goto restoreMatrices;
526 }
527 if (hits > 0) {
528 GLuint* p = selectBuffer;
529 for (GLint i = 0; i < hits; ++i) {
530 GLuint nnames = *p++;
531 // This bit of debug code or...
532 //GLuint zmin = *p++;
533 //GLuint zmax = *p++;
534 //G4cout << "Hit " << i << ": " << nnames << " names"
535 // << "\nzmin: " << zmin << ", zmax: " << zmax << G4endl;
536 // ...just increment the pointer
537 p++;
538 p++;
539 for (GLuint j = 0; j < nnames; ++j) {
540 GLuint name = *p++;
541 std::map<GLuint, G4AttHolder*>::iterator iter =
543 if (iter != fOpenGLSceneHandler.fPickMap.end()) {
544 G4AttHolder* attHolder = iter->second;
545 if(attHolder && attHolder->GetAttDefs().size()) {
546 for (size_t iAtt = 0;
547 iAtt < attHolder->GetAttDefs().size(); ++iAtt) {
548 std::ostringstream oss;
549 oss << G4AttCheck(attHolder->GetAttValues()[iAtt],
550 attHolder->GetAttDefs()[iAtt]);
552// G4cout
553// << "i,j, attHolder->GetAttDefs().size(): "
554// << i << ',' << j
555// << ", " << attHolder->GetAttDefs().size()
556// << G4endl;
557// G4cout << "G4OpenGLViewer::GetPickDetails: " << oss.str() << G4endl;
558 pickMap->addAttributes(oss.str());
559 pickMap->setHitNumber(i);
560 pickMap->setSubHitNumber(j);
561 pickMap->setPickName(name);
562 pickMapVector.push_back(pickMap);
563 }
564 }
565 }
566 }
567 }
568 }
569
570restoreMatrices:
571 glMatrixMode(GL_PROJECTION);
572 glPopMatrix();
573 glMatrixMode(GL_MODELVIEW);
574
575 return pickMapVector;
576}
const std::vector< const std::vector< G4AttValue > * > & GetAttValues() const
Definition: G4AttHolder.hh:59
const std::vector< const std::map< G4String, G4AttDef > * > & GetAttDefs() const
Definition: G4AttHolder.hh:61
std::map< GLuint, G4AttHolder * > fPickMap
void setSubHitNumber(G4int n)
void setHitNumber(G4int n)
void addAttributes(G4String att)
void setPickName(G4int n)
void g4GluPickMatrix(GLdouble x, GLdouble y, GLdouble width, GLdouble height, GLint viewport[4])
G4OpenGLSceneHandler & fOpenGLSceneHandler
virtual void DrawView()=0
#define BUFSIZE
Definition: liblist.c:40

References G4OpenGLViewerPickMap::addAttributes(), BUFSIZE, G4VViewer::DrawView(), G4OpenGLViewer::fIsGettingPickInfos, G4OpenGLViewer::fOpenGLSceneHandler, G4OpenGLSceneHandler::fPickMap, G4cout, G4endl, G4OpenGLViewer::g4GluPickMatrix(), G4AttHolder::GetAttDefs(), G4AttHolder::GetAttValues(), G4InuclParticleNames::name(), G4OpenGLViewerPickMap::setHitNumber(), G4OpenGLViewerPickMap::setPickName(), and G4OpenGLViewerPickMap::setSubHitNumber().

Referenced by G4OpenGLViewer::Pick(), and G4OpenGLQtViewer::updatePickInfosWidget().

◆ GetPrivateVisAttributesModifiers()

virtual const std::vector< G4ModelingParameters::VisAttributesModifier > * G4VViewer::GetPrivateVisAttributesModifiers ( ) const
virtualinherited

◆ getRealExportHeight()

G4int G4OpenGLViewer::getRealExportHeight ( )
privateinherited

Definition at line 1004 of file G4OpenGLViewer.cc.

1004 {
1005 if (fPrintSizeY == -1) {
1006 return fWinSize_y;
1007 }
1008 GLint dims[2];
1009 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
1010
1011 // L.Garnier 01-2010: Some problems with mac 10.6
1012 if ((dims[0] !=0 ) && (dims[1] !=0)) {
1013 if (fPrintSizeY > dims[1]){
1014 return dims[1];
1015 }
1016 }
1017 if (fPrintSizeY < -1){
1018 return 0;
1019 }
1020 return fPrintSizeY;
1021}
unsigned int fWinSize_y

References G4OpenGLViewer::fPrintSizeY, and G4OpenGLViewer::fWinSize_y.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealExportWidth()

G4int G4OpenGLViewer::getRealExportWidth ( )
privateinherited

Definition at line 985 of file G4OpenGLViewer.cc.

985 {
986 if (fPrintSizeX == -1) {
987 return fWinSize_x;
988 }
989 GLint dims[2];
990 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
991
992 // L.Garnier 01-2010: Some problems with mac 10.6
993 if ((dims[0] !=0 ) && (dims[1] !=0)) {
994 if (fPrintSizeX > dims[0]){
995 return dims[0];
996 }
997 }
998 if (fPrintSizeX < -1){
999 return 0;
1000 }
1001 return fPrintSizeX;
1002}
unsigned int fWinSize_x

References G4OpenGLViewer::fPrintSizeX, and G4OpenGLViewer::fWinSize_x.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::printNonVectoredEPS().

◆ getRealPrintFilename()

std::string G4OpenGLViewer::getRealPrintFilename ( )
protectedinherited

Definition at line 1066 of file G4OpenGLViewer.cc.

1066 {
1067 std::string temp = fExportFilename;
1068 if (fExportFilenameIndex != -1) {
1069 temp += std::string("_");
1070 std::ostringstream os;
1071 os << std::setw(4) << std::setfill('0') << fExportFilenameIndex;
1072 std::string nb_str = os.str();
1073 temp += nb_str;
1074 }
1075 temp += "."+fExportImageFormat;
1076 return temp;
1077}
G4String fExportFilename

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, and G4OpenGLViewer::fExportImageFormat.

Referenced by G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), G4OpenGLXmViewer::misc_callback(), G4OpenGLViewer::printGl2PS(), G4OpenGLViewer::printNonVectoredEPS(), and G4OpenGLViewer::setExportFilename().

◆ getSceneDepth()

GLdouble G4OpenGLViewer::getSceneDepth ( )
protectedinherited

Definition at line 1111 of file G4OpenGLViewer.cc.

1112{
1113 if (!fSceneHandler.GetScene()) {
1114 return 0;
1115 }
1116 const G4Point3D targetPoint
1120 if(radius<=0.) radius = 1.;
1121 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1122 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1123 return fVP.GetFarDistance (cameraDistance, pnear, radius)- pnear;
1124}
G4double GetFarDistance(G4double cameraDistance, G4double nearDistance, G4double radius) const
G4double GetNearDistance(G4double cameraDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

Referenced by G4OpenGLQtViewer::moveScene().

◆ getSceneFarWidth()

GLdouble G4OpenGLViewer::getSceneFarWidth ( )
protectedinherited

Definition at line 1094 of file G4OpenGLViewer.cc.

1095{
1096 if (!fSceneHandler.GetScene()) {
1097 return 0;
1098 }
1099 const G4Point3D targetPoint
1103 if(radius<=0.) radius = 1.;
1104 const G4double cameraDistance = fVP.GetCameraDistance (radius);
1105 const GLdouble pnear = fVP.GetNearDistance (cameraDistance, radius);
1106 const GLdouble pfar = fVP.GetFarDistance (cameraDistance, pnear, radius);
1107 return 2 * fVP.GetFrontHalfHeight (pfar, radius);
1108}
G4double GetFrontHalfHeight(G4double nearDistance, G4double radius) const

References G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetCameraDistance(), G4ViewParameters::GetCurrentTargetPoint(), G4Scene::GetExtent(), G4VisExtent::GetExtentRadius(), G4ViewParameters::GetFarDistance(), G4ViewParameters::GetFrontHalfHeight(), G4ViewParameters::GetNearDistance(), G4VSceneHandler::GetScene(), and G4Scene::GetStandardTargetPoint().

◆ GetSceneHandler()

G4VSceneHandler * G4VViewer::GetSceneHandler ( ) const
inherited

◆ getSceneNearWidth()

GLdouble G4OpenGLViewer::getSceneNearWidth ( )
protectedinherited

◆ GetShortName()

const G4String & G4VViewer::GetShortName ( ) const
inherited

◆ GetViewId()

G4int G4VViewer::GetViewId ( ) const
inherited

◆ GetViewParameters()

const G4ViewParameters & G4VViewer::GetViewParameters ( ) const
inherited

Referenced by G4OpenGLXmViewer::actions_callback(), G4OpenInventorSceneHandler::AddCircleSquare(), G4Qt3DSceneHandler::AddPrimitive(), G4ToolsSGSceneHandler::AddPrimitive(), G4OpenInventorSceneHandler::AddPrimitive(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenInventorSceneHandler::AddTransform(), G4OpenGLXmViewer::background_color_callback(), G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4VSceneHandler::CreateSectionSolid(), G4VisManager::CreateViewer(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), DrawView(), G4OpenGLStoredSceneHandler::EndModeling(), G4VisManager::EndOfRun(), G4VSceneHandler::GetAuxEdgeVisible(), G4VSceneHandler::GetColour(), G4VSceneHandler::GetDrawingStyle(), G4VSceneHandler::GetNoOfSides(), G4VSceneHandler::GetNumberOfCloudPoints(), G4VSceneHandler::GetTextColour(), G4VVisCommand::RefreshIfRequired(), G4VSceneHandler::RequestPrimitives(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), G4OpenInventorViewer::SetReducedWireFrame(), G4OpenInventorViewer::SetSolid(), and G4OpenInventorViewer::SetWireFrame().

◆ getWinHeight()

unsigned int G4OpenGLViewer::getWinHeight ( ) const
protectedinherited

◆ getWinWidth()

unsigned int G4OpenGLViewer::getWinWidth ( ) const
protectedinherited

◆ GetXConnection()

void G4OpenGLXViewer::GetXConnection ( )
protectedinherited

Definition at line 153 of file G4OpenGLXViewer.cc.

153 {
154// get a connection.
155 dpy = XOpenDisplay (0); // Uses DISPLAY environment variable.
156 if (!dpy) {
157 fViewId = -1; // This flags an error.
158 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer couldn't open display." << G4endl;
159 return;
160 }
161
162// make sure OpenGL is supported and installed properly.
163 if (!glXQueryExtension (dpy, &errorBase, &eventBase)) {
164 fViewId = -1; // This flags an error.
165 G4cerr << "G4OpenGLXViewer::G4OpenGLXViewer X Server has no GLX extension."
166 << G4endl;
167 return;
168 }
169
170}

References G4OpenGLXViewer::dpy, G4OpenGLXViewer::errorBase, G4OpenGLXViewer::eventBase, G4VViewer::fViewId, G4cerr, and G4endl.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ grabPixels()

GLubyte * G4OpenGLViewer::grabPixels ( int  inColor,
unsigned int  width,
unsigned int  height 
)
privateinherited

Definition at line 578 of file G4OpenGLViewer.cc.

579 {
580
581 GLubyte* buffer;
582 GLint swapbytes, lsbfirst, rowlength;
583 GLint skiprows, skippixels, alignment;
584 GLenum format;
585 int size;
586
587 if (inColor) {
588 format = GL_RGB;
589 size = width*height*3;
590 } else {
591 format = GL_LUMINANCE;
592 size = width*height*1;
593 }
594
595 buffer = new GLubyte[size];
596 if (buffer == NULL)
597 return NULL;
598
599 glGetIntegerv (GL_UNPACK_SWAP_BYTES, &swapbytes);
600 glGetIntegerv (GL_UNPACK_LSB_FIRST, &lsbfirst);
601 glGetIntegerv (GL_UNPACK_ROW_LENGTH, &rowlength);
602
603 glGetIntegerv (GL_UNPACK_SKIP_ROWS, &skiprows);
604 glGetIntegerv (GL_UNPACK_SKIP_PIXELS, &skippixels);
605 glGetIntegerv (GL_UNPACK_ALIGNMENT, &alignment);
606
607 glPixelStorei (GL_UNPACK_SWAP_BYTES, GL_FALSE);
608 glPixelStorei (GL_UNPACK_LSB_FIRST, GL_FALSE);
609 glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
610
611 glPixelStorei (GL_UNPACK_SKIP_ROWS, 0);
612 glPixelStorei (GL_UNPACK_SKIP_PIXELS, 0);
613 glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
614
615 glReadBuffer(GL_FRONT);
616 glReadPixels (0, 0, (GLsizei)width, (GLsizei)height, format, GL_UNSIGNED_BYTE, (GLvoid*) buffer);
617
618 glPixelStorei (GL_UNPACK_SWAP_BYTES, swapbytes);
619 glPixelStorei (GL_UNPACK_LSB_FIRST, lsbfirst);
620 glPixelStorei (GL_UNPACK_ROW_LENGTH, rowlength);
621
622 glPixelStorei (GL_UNPACK_SKIP_ROWS, skiprows);
623 glPixelStorei (GL_UNPACK_SKIP_PIXELS, skippixels);
624 glPixelStorei (GL_UNPACK_ALIGNMENT, alignment);
625
626 return buffer;
627}
#define buffer
Definition: xmlparse.cc:628

References buffer.

Referenced by G4OpenGLViewer::printNonVectoredEPS().

◆ HaloingFirstPass()

void G4OpenGLViewer::HaloingFirstPass ( )
protectedinherited

Definition at line 441 of file G4OpenGLViewer.cc.

441 {
442
443 //To perform haloing, first Draw all information to the depth buffer
444 //alone, using a chunky line width, and then Draw all info again, to
445 //the colour buffer, setting a thinner line width an the depth testing
446 //function to less than or equal, so if two lines cross, the one
447 //passing behind the other will not pass the depth test, and so not
448 //get rendered either side of the infront line for a short distance.
449
450 //First, disable writing to the colo(u)r buffer...
451 glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
452
453 //Now enable writing to the depth buffer...
454 glDepthMask (GL_TRUE);
455 glDepthFunc (GL_LESS);
456 glClearDepth (1.0);
457
458 //Finally, set the line width to something wide...
459 ChangeLineWidth(3.0);
460
461}
void ChangeLineWidth(G4double width)

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and DrawView().

◆ HaloingSecondPass()

void G4OpenGLViewer::HaloingSecondPass ( )
protectedinherited

Definition at line 463 of file G4OpenGLViewer.cc.

463 {
464
465 //And finally, turn the colour buffer back on with a sesible line width...
466 glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
467 glDepthFunc (GL_LEQUAL);
468 ChangeLineWidth(1.0);
469
470}

References G4OpenGLViewer::ChangeLineWidth().

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and DrawView().

◆ HLRFirstPass()

void G4OpenGLViewer::HLRFirstPass ( )
protectedinherited

◆ HLRSecondPass()

void G4OpenGLViewer::HLRSecondPass ( )
protectedinherited

◆ HLRThirdPass()

void G4OpenGLViewer::HLRThirdPass ( )
protectedinherited

◆ Initialise()

void G4OpenGLStoredXViewer::Initialise ( )
virtual

Reimplemented from G4VViewer.

Definition at line 59 of file G4OpenGLStoredXViewer.cc.

59 {
60
61#ifdef G4DEBUG_VIS_OGL
62 printf("G4OpenGLStoredXViewer::Initialise\n");
63#endif
67
69
70 glDrawBuffer (GL_BACK);
71}
void CreateGLXContext(XVisualInfo *vi)
virtual void CreateFontLists()
virtual void CreateMainWindow()

References G4OpenGLXViewer::CreateFontLists(), G4OpenGLXViewer::CreateGLXContext(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLViewer::InitializeGLView(), and G4OpenGLXViewer::vi_stored.

◆ InitializeGLView()

void G4OpenGLViewer::InitializeGLView ( )
protectedinherited

Definition at line 127 of file G4OpenGLViewer.cc.

128{
129#ifdef G4OPENGL_VERSION_2
130 if (fVboDrawer) {
131
132 // First, load a simple shader
133 fShaderProgram = glCreateProgram();
134 Shader vertexShader = glCreateShader(GL_VERTEX_SHADER);
135 const char * vSrc = fVboDrawer->getVertexShaderSrc();
136 glShaderSource(vertexShader, 1, &vSrc, NULL);
137 glCompileShader(vertexShader);
138 glAttachShader(fShaderProgram, vertexShader);
139
140 Shader fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
141 const char * fSrc = fVboDrawer->getFragmentShaderSrc();
142 glShaderSource(fragmentShader, 1, &fSrc, NULL);
143 glCompileShader(fragmentShader);
144
145 glAttachShader(fShaderProgram, fragmentShader);
146 glLinkProgram(fShaderProgram);
147 glUseProgram(fShaderProgram);
148
149 // UniformLocation uColor = getUniformLocation(fShaderProgram, "uColor");
150 // uniform4fv(uColor, [0.0, 0.3, 0.0, 1.0]);
151
152 // Extract the references to the attributes from the shader.
153
154 fVertexPositionAttribute =
155 glGetAttribLocation(fShaderProgram, "aVertexPosition");
156
157
158 glEnableVertexAttribArray(fVertexPositionAttribute);
159
160 // Extract the references the uniforms from the shader
161 fpMatrixUniform = glGetUniformLocation(fShaderProgram, "uPMatrix");
162 fcMatrixUniform = glGetUniformLocation(fShaderProgram, "uCMatrix");
163 fmvMatrixUniform = glGetUniformLocation(fShaderProgram, "uMVMatrix");
164 fnMatrixUniform = glGetUniformLocation(fShaderProgram, "uNMatrix");
165 ftMatrixUniform = glGetUniformLocation(fShaderProgram, "uTMatrix");
166
167 /* glUniformMatrix4fv(fcMatrixUniform, 1, 0, identity);
168 glUniformMatrix4fv(fpMatrixUniform, 1, 0, identity);
169 glUniformMatrix4fv(ftMatrixUniform, 1, 0, identity);
170 glUniformMatrix4fv(fmvMatrixUniform, 1, 0, identity);
171 */
172 // We have to set that in order to avoid calls on opengl commands before all is ready
173 fGlViewInitialized = true;
174 }
175#endif
176
177 if (fWinSize_x == 0) {
179 }
180 if (fWinSize_y == 0) {
182 }
183
184 glClearColor (0.0, 0.0, 0.0, 0.0);
185 glClearDepth (1.0);
186#ifndef G4OPENGL_VERSION_2
187 glDisable (GL_LINE_SMOOTH);
188 glDisable (GL_POLYGON_SMOOTH);
189#endif
190
191// clear the buffers and window?
192 ClearView ();
193 FinishView ();
194
195 glDepthFunc (GL_LEQUAL);
196 glDepthMask (GL_TRUE);
197
198 glEnable (GL_BLEND);
199 glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
200
201}
virtual void FinishView()
Definition: G4VViewer.cc:101

References G4OpenGLViewer::ClearView(), G4OpenGLViewer::fGlViewInitialized, G4VViewer::FinishView(), G4VViewer::fVP, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4ViewParameters::GetWindowSizeHintX(), and G4ViewParameters::GetWindowSizeHintY().

Referenced by G4OpenGLImmediateXmViewer::Initialise(), G4OpenGLImmediateXViewer::Initialise(), G4OpenGLStoredXmViewer::Initialise(), Initialise(), G4OpenGLImmediateQtViewer::initializeGL(), and G4OpenGLStoredQtViewer::initializeGL().

◆ isFramebufferReady()

G4bool G4OpenGLViewer::isFramebufferReady ( )
protectedinherited

Definition at line 730 of file G4OpenGLViewer.cc.

730 {
731 bool check = false;
732#ifdef G4VIS_BUILD_OPENGLQT_DRIVER
733 check = true;
734#endif
735#ifdef G4VIS_BUILD_OPENGLX_DRIVER
736 check = false;
737#endif
738#ifdef G4VIS_BUILD_OPENGLXM_DRIVER
739 check = false;
740#endif
741#ifdef G4VIS_BUILD_OPENGLWIN32_DRIVER
742 check = false;
743#endif
744
745#if GL_ARB_framebuffer_object
746 if (check) {
747// if ( glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_UNDEFINED) {
748// return false;
749// }
750 }
751#endif
752 return true;
753}

Referenced by G4OpenGLViewer::ClearView(), G4OpenGLViewer::ClearViewWithoutFlush(), G4OpenGLImmediateQtViewer::paintEvent(), and G4OpenGLStoredQtViewer::paintEvent().

◆ isGl2psWriting()

bool G4OpenGLViewer::isGl2psWriting ( )
protectedinherited

Return if gl2ps is currently writing

Definition at line 720 of file G4OpenGLViewer.cc.

720 {
721
722 if (!fGL2PSAction) return false;
724 return true;
725 }
726 return false;
727}
bool fileWritingEnabled() const
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//

References G4OpenGLViewer::fGL2PSAction, and G4OpenGL2PSAction::fileWritingEnabled().

Referenced by G4OpenGLViewer::ChangeLineWidth(), G4OpenGLViewer::ChangePointSize(), G4OpenGLQtViewer::DrawText(), G4OpenGLViewer::DrawText(), and G4OpenGLXViewer::DrawText().

◆ KernelVisitDecision()

void G4OpenGLStoredViewer::KernelVisitDecision ( )
protectedinherited

Definition at line 56 of file G4OpenGLStoredViewer.cc.

56 {
57
58 // If there's a significant difference with the last view parameters
59 // of either the scene handler or this viewer, trigger a rebuild.
60
64 }
65}
virtual G4bool CompareForKernelVisit(G4ViewParameters &)
void NeedKernelVisit()
Definition: G4VViewer.cc:78

References G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler, G4OpenGLStoredViewer::fLastVP, G4OpenGLStoredSceneHandler::fTopPODL, and G4VViewer::NeedKernelVisit().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), and DrawView().

◆ NeedKernelVisit()

void G4VViewer::NeedKernelVisit ( )
inherited

Definition at line 78 of file G4VViewer.cc.

78 {
79
80 fNeedKernelVisit = true;
81
82 // At one time I thought we'd better notify all viewers. But I guess
83 // each viewer can take care of itself, so the following code is
84 // redundant (but keep it commented out for now). (John Allison)
85 // Notify all viewers that a kernel visit is required.
86 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
87 // G4ViewerListConstIterator i;
88 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
89 // (*i) -> SetNeedKernelVisit ();
90 // }
91 // ??...but, there's a problem in OpenGL Stored which seems to
92 // require *all* viewers to revisit the kernel, so...
93 // const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
94 // G4ViewerListConstIterator i;
95 // for (i = viewerList.begin(); i != viewerList.end(); i++) {
96 // (*i) -> SetNeedKernelVisit (true);
97 // }
98 // Feb 2005 - commented out. Let's fix OpenGL if necessary.
99}

References G4VViewer::fNeedKernelVisit.

Referenced by G4OpenGLImmediateQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLImmediateWin32Viewer::DrawView(), G4OpenGLImmediateXmViewer::DrawView(), G4OpenGLImmediateXViewer::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), G4VisManager::GeometryHasChanged(), G4OpenGLStoredViewer::KernelVisitDecision(), G4OpenInventorViewer::KernelVisitDecision(), G4Qt3DViewer::KernelVisitDecision(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::KernelVisitDecision(), G4VisManager::NotifyHandlers(), G4OpenGLImmediateViewer::ProcessView(), G4VisCommandViewerRebuild::SetNewValue(), G4OpenInventorViewer::SetPreview(), G4OpenInventorViewer::SetPreviewAndFull(), G4OpenInventorViewer::SetReducedWireFrame(), and G4OpenInventorViewer::UpdateScene().

◆ Pick()

G4String G4OpenGLViewer::Pick ( GLdouble  x,
GLdouble  y 
)
protectedvirtualinherited

Definition at line 472 of file G4OpenGLViewer.cc.

473{
474 const std::vector < G4OpenGLViewerPickMap* > & pickMap = GetPickDetails(x,y);
475 G4String txt = "";
476 if (pickMap.size() == 0) {
477// txt += "No hits recorded.";;
478 } else {
479 for (unsigned int a=0; a < pickMap.size(); a++) {
480 if (pickMap[a]->getAttributes().size() > 0) {
481 txt += pickMap[a]->print();
482 }
483 }
484 }
485 return txt;
486}
const std::vector< G4OpenGLViewerPickMap * > & GetPickDetails(GLdouble x, GLdouble y)

References G4OpenGLViewer::GetPickDetails().

Referenced by G4OpenGLXViewer::ShowView().

◆ POSelected()

virtual G4bool G4OpenGLStoredViewer::POSelected ( size_t  )
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 67 of file G4OpenGLStoredViewer.hh.

67{return true;}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ printGl2PS()

bool G4OpenGLViewer::printGl2PS ( )
privateinherited

Definition at line 886 of file G4OpenGLViewer.cc.

886 {
887
888 int width = getRealExportWidth();
889 int height = getRealExportHeight();
890 bool res = true;
891
892 // no need to redraw at each new primitive for printgl2PS
893 G4OpenGLSceneHandler& oglSceneHandler = dynamic_cast<G4OpenGLSceneHandler&>(fSceneHandler);
894 G4OpenGLSceneHandler::FlushAction originalFlushAction = oglSceneHandler.GetFlushAction();
896
897 if (!fGL2PSAction) return false;
898
900 // try to resize
901 int X = fWinSize_x;
902 int Y = fWinSize_y;
903
904 fWinSize_x = width;
905 fWinSize_y = height;
906 // Laurent G. 16/03/10 : Not the good way to do.
907 // We should draw in a new offscreen context instead of
908 // resizing and drawing in current window...
909 // This should be solve when we will do an offscreen method
910 // to render OpenGL
911 // See :
912 // http://developer.apple.com/Mac/library/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/opengl_offscreen.html
913 // http://www.songho.ca/opengl/gl_fbo.html
914
915 ResizeGLView();
916 bool extendBuffer = true;
917 bool endWriteAction = false;
918 bool beginWriteAction = true;
919 bool filePointerOk = true;
920 while ((extendBuffer) && (! endWriteAction) && (filePointerOk)) {
921
922 beginWriteAction = fGL2PSAction->enableFileWriting();
923 // 3 cases :
924 // - true
925 // - false && ! fGL2PSAction->fileWritingEnabled() => bad file name
926 // - false && fGL2PSAction->fileWritingEnabled() => buffer size problem ?
927
928 filePointerOk = fGL2PSAction->fileWritingEnabled();
929
930 if (beginWriteAction) {
931
932 // Set the viewport
933 // By default, we choose the line width (trajectories...)
935 // By default, we choose the point size (markers...)
937
938 DrawView ();
939 endWriteAction = fGL2PSAction->disableFileWriting();
940 }
941 if (filePointerOk) {
942 if ((! endWriteAction) || (! beginWriteAction)) {
943 extendBuffer = fGL2PSAction->extendBufferSize();
944 }
945 }
946 }
948
949 if (!extendBuffer ) {
950 G4cerr << "ERROR: gl2ps buffer size is not big enough to print this geometry. Try to extend it. No output produced"<< G4endl;
951 res = false;
952 }
953 if (!beginWriteAction ) {
954 G4cerr << "ERROR: saving file "<<getRealPrintFilename().c_str()<<". Check read/write access. No output produced" << G4endl;
955 res = false;
956 }
957 if (!endWriteAction ) {
958 G4cerr << "gl2ps error. No output produced" << G4endl;
959 res = false;
960 }
961 fWinSize_x = X;
962 fWinSize_y = Y;
963
964 oglSceneHandler.SetFlushAction(originalFlushAction);
965
966 // Reset for next time (useful is size change)
967 // fPrintSizeX = 0;
968 // fPrintSizeY = 0;
969
970 return res;
971}
G4double Y(G4double density)
bool enableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool disableFileWriting()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void setFileName(const char *)
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
bool extendBufferSize()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
void resetBufferSizeParameters()
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!//
static void SetFlushAction(FlushAction action)
static FlushAction GetFlushAction()

References G4OpenGL2PSAction::disableFileWriting(), G4VViewer::DrawView(), G4OpenGL2PSAction::enableFileWriting(), G4OpenGL2PSAction::extendBufferSize(), G4OpenGLViewer::fGL2PSAction, G4OpenGLViewer::fGl2psDefaultLineWith, G4OpenGLViewer::fGl2psDefaultPointSize, G4OpenGL2PSAction::fileWritingEnabled(), G4VViewer::fSceneHandler, G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, G4endl, G4OpenGLSceneHandler::GetFlushAction(), G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLSceneHandler::never, G4OpenGL2PSAction::resetBufferSizeParameters(), G4OpenGLViewer::ResizeGLView(), G4OpenGL2PSAction::setFileName(), G4OpenGLSceneHandler::SetFlushAction(), G4OpenGL2PSAction::setLineWidth(), G4OpenGL2PSAction::setPointSize(), and Y().

Referenced by G4OpenGLViewer::printVectoredEPS().

◆ printNonVectoredEPS()

bool G4OpenGLViewer::printNonVectoredEPS ( )
privateinherited

Definition at line 633 of file G4OpenGLViewer.cc.

633 {
634
635 int width = getRealExportWidth();
636 int height = getRealExportHeight();
637
638 FILE* fp;
639 GLubyte* pixels;
640 GLubyte* curpix;
641 int components, pos, i;
642
643 pixels = grabPixels (fPrintColour, width, height);
644
645 if (pixels == NULL) {
646 G4cerr << "Failed to get pixels from OpenGl viewport" << G4endl;
647 return false;
648 }
649 if (fPrintColour) {
650 components = 3;
651 } else {
652 components = 1;
653 }
654 std::string name = getRealPrintFilename();
655 fp = fopen (name.c_str(), "w");
656 if (fp == NULL) {
657 G4cerr << "Can't open filename " << name.c_str() << G4endl;
658 return false;
659 }
660
661 fprintf (fp, "%%!PS-Adobe-2.0 EPSF-1.2\n");
662 fprintf (fp, "%%%%Title: %s\n", name.c_str());
663 fprintf (fp, "%%%%Creator: OpenGL pixmap render output\n");
664 fprintf (fp, "%%%%BoundingBox: 0 0 %d %d\n", width, height);
665 fprintf (fp, "%%%%EndComments\n");
666 fprintf (fp, "gsave\n");
667 fprintf (fp, "/bwproc {\n");
668 fprintf (fp, " rgbproc\n");
669 fprintf (fp, " dup length 3 idiv string 0 3 0 \n");
670 fprintf (fp, " 5 -1 roll {\n");
671 fprintf (fp, " add 2 1 roll 1 sub dup 0 eq\n");
672 fprintf (fp, " { pop 3 idiv 3 -1 roll dup 4 -1 roll dup\n");
673 fprintf (fp, " 3 1 roll 5 -1 roll } put 1 add 3 0 \n");
674 fprintf (fp, " { 2 1 roll } ifelse\n");
675 fprintf (fp, " }forall\n");
676 fprintf (fp, " pop pop pop\n");
677 fprintf (fp, "} def\n");
678 fprintf (fp, "systemdict /colorimage known not {\n");
679 fprintf (fp, " /colorimage {\n");
680 fprintf (fp, " pop\n");
681 fprintf (fp, " pop\n");
682 fprintf (fp, " /rgbproc exch def\n");
683 fprintf (fp, " { bwproc } image\n");
684 fprintf (fp, " } def\n");
685 fprintf (fp, "} if\n");
686 fprintf (fp, "/picstr %d string def\n", width * components);
687 fprintf (fp, "%d %d scale\n", width, height);
688 fprintf (fp, "%d %d %d\n", width, height, 8);
689 fprintf (fp, "[%d 0 0 %d 0 0]\n", width, height);
690 fprintf (fp, "{currentfile picstr readhexstring pop}\n");
691 fprintf (fp, "false %d\n", components);
692 fprintf (fp, "colorimage\n");
693
694 curpix = (GLubyte*) pixels;
695 pos = 0;
696 for (i = width*height*components; i>0; i--) {
697 fprintf (fp, "%02hx ", (unsigned short)(*(curpix++)));
698 if (++pos >= 32) {
699 fprintf (fp, "\n");
700 pos = 0;
701 }
702 }
703 if (pos)
704 fprintf (fp, "\n");
705
706 fprintf (fp, "grestore\n");
707 fprintf (fp, "showpage\n");
708 delete [] pixels;
709 fclose (fp);
710
711 // Reset for next time (useful is size change)
712 // fPrintSizeX = -1;
713 // fPrintSizeY = -1;
714
715 return true;
716}
static const G4double pos
GLubyte * grabPixels(int inColor, unsigned int width, unsigned int height)

References G4OpenGLViewer::fPrintColour, G4cerr, G4endl, G4OpenGLViewer::getRealExportHeight(), G4OpenGLViewer::getRealExportWidth(), G4OpenGLViewer::getRealPrintFilename(), G4OpenGLViewer::grabPixels(), G4InuclParticleNames::name(), and pos.

Referenced by G4OpenGLViewer::exportImage().

◆ printVectoredEPS()

bool G4OpenGLViewer::printVectoredEPS ( )
privateinherited

Definition at line 629 of file G4OpenGLViewer.cc.

629 {
630 return printGl2PS();
631}

References G4OpenGLViewer::printGl2PS().

Referenced by G4OpenGLViewer::exportImage().

◆ ProcessView()

void G4VViewer::ProcessView ( )
inherited

Definition at line 105 of file G4VViewer.cc.

106{
107 // If the scene has changed, or if the concrete viewer has decided
108 // that it necessary to visit the kernel, perhaps because the view
109 // parameters have changed significantly (this should be done in the
110 // concrete viewer's DrawView)...
111 if (fNeedKernelVisit) {
112 // Reset flag. This must be done before ProcessScene to prevent
113 // recursive calls when recomputing transients...
114 fNeedKernelVisit = false;
117 }
118}
virtual void ProcessScene()
virtual void ClearStore()

References G4VSceneHandler::ClearStore(), G4VViewer::fNeedKernelVisit, G4VViewer::fSceneHandler, and G4VSceneHandler::ProcessScene().

Referenced by G4OpenGLStoredQtViewer::ComputeView(), G4DAWNFILEViewer::DrawView(), G4GMocrenFileViewer::DrawView(), G4HepRepFileViewer::DrawView(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VTreeViewer::DrawView(), G4VRML2FileViewer::DrawView(), G4VtkViewer::DrawView(), and G4OpenGLImmediateViewer::ProcessView().

◆ RefreshView()

void G4VViewer::RefreshView ( )
inherited

◆ ResetView()

void G4OpenGLViewer::ResetView ( )
protectedvirtualinherited

Reimplemented from G4VViewer.

Reimplemented in G4OpenGLXmViewer.

Definition at line 434 of file G4OpenGLViewer.cc.

434 {
436 fRot_sens = 1;
437 fPan_sens = 0.01;
438}
virtual void ResetView()

References G4OpenGLViewer::fPan_sens, G4OpenGLViewer::fRot_sens, and G4VViewer::ResetView().

Referenced by G4OpenGLQtViewer::ResetView(), and G4OpenGLXmViewer::ResetView().

◆ ResizeGLView()

void G4OpenGLViewer::ResizeGLView ( )
protectedinherited

Set the viewport of the scene MAXIMUM SIZE is : GLint dims[2]; glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);

Definition at line 250 of file G4OpenGLViewer.cc.

251{
252 // Check size
253 GLint dims[2];
254 dims[0] = 0;
255 dims[1] = 0;
256
257 glGetIntegerv(GL_MAX_VIEWPORT_DIMS, dims);
258
259 if ((dims[0] !=0 ) && (dims[1] !=0)) {
260
261 if (fWinSize_x > (unsigned)dims[0]) {
262 G4cerr << "Try to resize view greater than max X viewport dimension. Desired size "<<fWinSize_x <<" is resize to "<< dims[0] << G4endl;
263 fWinSize_x = dims[0];
264 }
265 if (fWinSize_y > (unsigned)dims[1]) {
266 G4cerr << "Try to resize view greater than max Y viewport dimension. Desired size "<<fWinSize_y <<" is resize to "<< dims[1] << G4endl;
267 fWinSize_y = dims[1];
268 }
269 }
270
271 glViewport(0, 0, fWinSize_x,fWinSize_y);
272
273
274}

References G4OpenGLViewer::fWinSize_x, G4OpenGLViewer::fWinSize_y, G4cerr, and G4endl.

Referenced by G4OpenGLViewer::printGl2PS(), and G4OpenGLViewer::SetView().

◆ ResizeWindow()

void G4OpenGLViewer::ResizeWindow ( unsigned int  aWidth,
unsigned int  aHeight 
)
protectedinherited

◆ rotateScene()

void G4OpenGLViewer::rotateScene ( G4double  dx,
G4double  dy 
)
protectedinherited

Definition at line 1128 of file G4OpenGLViewer.cc.

1129{
1132 } else {
1133 if( dx != 0) {
1134 rotateSceneThetaPhi(dx,0);
1135 }
1136 if( dy != 0) {
1137 rotateSceneThetaPhi(0,dy);
1138 }
1139 }
1140}
void rotateSceneInViewDirection(G4double dx, G4double dy)
void rotateSceneThetaPhi(G4double dx, G4double dy)
RotationStyle GetRotationStyle() const

References G4ViewParameters::freeRotation, G4VViewer::fVP, G4ViewParameters::GetRotationStyle(), G4OpenGLViewer::rotateSceneInViewDirection(), and G4OpenGLViewer::rotateSceneThetaPhi().

Referenced by G4OpenGLXmViewer::rotate_in_phi(), G4OpenGLXmViewer::rotate_in_theta(), and G4OpenGLQtViewer::rotateQtScene().

◆ rotateSceneInViewDirection()

void G4OpenGLViewer::rotateSceneInViewDirection ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1241 of file G4OpenGLViewer.cc.

1242{
1243 if (!fSceneHandler.GetScene()) {
1244 return;
1245 }
1246
1247 G4Vector3D vp;
1248 G4Vector3D up;
1249
1250 G4Vector3D xprime;
1251 G4Vector3D yprime;
1252 G4Vector3D zprime;
1253
1254 G4Vector3D new_vp;
1255 G4Vector3D new_up;
1256
1257 G4Vector3D a1;
1258 G4Vector3D a2;
1259 G4Vector3D delta;
1260 G4Vector3D viewPoint;
1261
1262 dx = dx/100;
1263 dy = dy/100;
1264
1265 //phi spin stuff here
1266
1267 vp = fVP.GetViewpointDirection ().unit();
1268 up = fVP.GetUpVector ().unit();
1269
1270 G4Vector3D zPrimeVector = G4Vector3D(up.y()*vp.z()-up.z()*vp.y(),
1271 up.z()*vp.x()-up.x()*vp.z(),
1272 up.x()*vp.y()-up.y()*vp.x());
1273
1274 viewPoint = vp/fRot_sens + (zPrimeVector*dx - up*dy) ;
1275 new_up = G4Vector3D(viewPoint.y()*zPrimeVector.z()-viewPoint.z()*zPrimeVector.y(),
1276 viewPoint.z()*zPrimeVector.x()-viewPoint.x()*zPrimeVector.z(),
1277 viewPoint.x()*zPrimeVector.y()-viewPoint.y()*zPrimeVector.x());
1278
1279 G4Vector3D new_upUnit = new_up.unit();
1280
1281
1282
1283 fVP.SetUpVector(new_upUnit);
1284 fVP.SetViewAndLights (viewPoint);
1285}
void SetViewAndLights(const G4Vector3D &viewpointDirection)
const G4Vector3D & GetUpVector() const
void SetUpVector(const G4Vector3D &upVector)

References G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneThetaPhi()

void G4OpenGLViewer::rotateSceneThetaPhi ( G4double  dx,
G4double  dy 
)
privateinherited

Definition at line 1157 of file G4OpenGLViewer.cc.

1158{
1159 if (!fSceneHandler.GetScene()) {
1160 return;
1161 }
1162
1163 G4Vector3D vp;
1164 G4Vector3D up;
1165
1166 G4Vector3D xprime;
1167 G4Vector3D yprime;
1168 G4Vector3D zprime;
1169
1170 G4double delta_alpha;
1171 G4double delta_theta;
1172
1173 G4Vector3D new_vp;
1174 G4Vector3D new_up;
1175
1176 G4double cosalpha;
1177 G4double sinalpha;
1178
1179 G4Vector3D a1;
1180 G4Vector3D a2;
1181 G4Vector3D delta;
1182 G4Vector3D viewPoint;
1183
1184
1185 //phi spin stuff here
1186
1187 vp = fVP.GetViewpointDirection ().unit ();
1188 up = fVP.GetUpVector ().unit ();
1189
1190 yprime = (up.cross(vp)).unit();
1191 zprime = (vp.cross(yprime)).unit();
1192
1194 delta_alpha = dy * fRot_sens;
1195 delta_theta = -dx * fRot_sens;
1196 } else {
1197 delta_alpha = -dy * fRot_sens;
1198 delta_theta = dx * fRot_sens;
1199 }
1200
1201 delta_alpha *= CLHEP::deg;
1202 delta_theta *= CLHEP::deg;
1203
1204 new_vp = std::cos(delta_alpha) * vp + std::sin(delta_alpha) * zprime;
1205
1206 // to avoid z rotation flipping
1207 // to allow more than 360∞ rotation
1208
1210 new_up = (new_vp.cross(yprime)).unit();
1211 if (new_vp.z()*vp.z() <0) {
1212 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1213 }
1214 } else {
1215 new_up = up;
1216 if (new_vp.z()*vp.z() <0) {
1217 new_up.set(new_up.x(),-new_up.y(),new_up.z());
1218 }
1219 }
1220 fVP.SetUpVector(new_up);
1222 // Rotates by fixed azimuthal angle delta_theta.
1223
1224 cosalpha = new_up.dot (new_vp.unit());
1225 sinalpha = std::sqrt (1. - std::pow (cosalpha, 2));
1226 yprime = (new_up.cross (new_vp.unit())).unit ();
1227 xprime = yprime.cross (new_up);
1228 // Projection of vp on plane perpendicular to up...
1229 a1 = sinalpha * xprime;
1230 // Required new projection...
1231 a2 = sinalpha * (std::cos (delta_theta) * xprime + std::sin (delta_theta) * yprime);
1232 // Required Increment vector...
1233 delta = a2 - a1;
1234 // So new viewpoint is...
1235 viewPoint = new_vp.unit() + delta;
1236
1237 fVP.SetViewAndLights (viewPoint);
1238}
G4bool GetLightsMoveWithCamera() const
BasicVector3D< T > cross(const BasicVector3D< T > &v) const
void set(T x1, T y1, T z1)
T dot(const BasicVector3D< T > &v) const
static constexpr double deg

References HepGeom::BasicVector3D< T >::cross(), CLHEP::deg, HepGeom::BasicVector3D< T >::dot(), G4OpenGLViewer::fRot_sens, G4VViewer::fSceneHandler, G4VViewer::fVP, G4ViewParameters::GetLightsMoveWithCamera(), G4VSceneHandler::GetScene(), G4ViewParameters::GetUpVector(), G4ViewParameters::GetViewpointDirection(), HepGeom::BasicVector3D< T >::set(), G4ViewParameters::SetUpVector(), G4ViewParameters::SetViewAndLights(), HepGeom::BasicVector3D< T >::unit(), HepGeom::BasicVector3D< T >::x(), HepGeom::BasicVector3D< T >::y(), and HepGeom::BasicVector3D< T >::z().

Referenced by G4OpenGLViewer::rotateScene(), and G4OpenGLViewer::rotateSceneToggle().

◆ rotateSceneToggle()

void G4OpenGLViewer::rotateSceneToggle ( G4double  dx,
G4double  dy 
)
protectedinherited

◆ SetDefaultViewParameters()

void G4VViewer::SetDefaultViewParameters ( const G4ViewParameters vp)
inherited

◆ setExportFilename()

bool G4OpenGLViewer::setExportFilename ( G4String  name,
G4bool  inc = true 
)
protectedinherited

If name is "" or "!", filename and extension will have the default value. If name is "toto.png", set the name to "toto" and the format to "png". No incremented suffix is added. If name is "toto", set the name to "toto" and the format to default (or current format if specify). If name is the same as previous, do not reset incremented suffix.

Definition at line 1034 of file G4OpenGLViewer.cc.

1034 {
1035 if (name == "!") {
1036 name = "";
1037 }
1038
1039 if (inc) {
1040 if ((name != "") && (fExportFilename != name)) {
1042 }
1043 } else {
1045 }
1046
1047 if (name.size() == 0) {
1048 name = getRealPrintFilename().c_str();
1049 } else {
1050 // guess format by extention
1051 std::string extension = name.substr(name.find_last_of(".") + 1);
1052 // If there is a dot in the name the above might find rubbish, so...
1053 if (extension.size() >= 3 && extension.size() <= 4) { // Possible extension
1054 if (setExportImageFormat(extension, false)) { // Extension found
1055 fExportFilename = name.substr(0,name.find_last_of("."));
1056 } else { // No viable extension found
1057 return false;
1058 }
1059 } else { // Assume name is already the required without-extension part
1061 }
1062 }
1063 return true;
1064}

References G4OpenGLViewer::fExportFilename, G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::getRealPrintFilename(), G4InuclParticleNames::name(), and G4OpenGLViewer::setExportImageFormat().

Referenced by G4OpenGLQtViewer::actionSaveImage(), G4OpenGLQtViewer::exportImage(), G4OpenGLViewer::exportImage(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportImageFormat()

bool G4OpenGLViewer::setExportImageFormat ( std::string  format,
bool  quiet = false 
)
inherited

Definition at line 1292 of file G4OpenGLViewer.cc.

1292 {
1293 bool found = false;
1294 std::string list;
1295 for (unsigned int a=0; a<fExportImageFormatVector.size(); a++) {
1296 list +=fExportImageFormatVector.at(a) + " ";
1297
1298 if (fExportImageFormatVector.at(a) == format) {
1299 if (! quiet) {
1300 G4cout << " Changing export format to \"" << format << "\"" << G4endl;
1301 }
1302 if (format != fExportImageFormat) {
1304 fExportImageFormat = format;
1305 }
1306 return true;
1307 }
1308 }
1309 if (! found) {
1310 if (format.size() == 0) {
1311 G4cout << " Current formats availables are : " << list << G4endl;
1312 } else {
1313 G4cerr << " Format \"" << format << "\" is not available for the selected viewer. Current formats availables are : " << list << G4endl;
1314 }
1315 }
1316 return false;
1317}

References G4OpenGLViewer::fExportFilenameIndex, G4OpenGLViewer::fExportImageFormat, G4OpenGLViewer::fExportImageFormatVector, G4cerr, G4cout, and G4endl.

Referenced by G4OpenGLViewer::exportImage(), G4OpenGLImmediateQtViewer::initializeGL(), G4OpenGLStoredQtViewer::initializeGL(), G4OpenGLViewer::setExportFilename(), and G4OpenGLViewerMessenger::SetNewValue().

◆ setExportSize()

void G4OpenGLViewer::setExportSize ( G4int  X,
G4int  Y 
)
protectedinherited

◆ SetName()

void G4VViewer::SetName ( const G4String name)
inherited

Definition at line 72 of file G4VViewer.cc.

72 {
73 fName = name;
74 fShortName = fName.substr(0, fName.find (' '));
76}
G4String fShortName
Definition: G4VViewer.hh:218
void strip(G4String &str, char c=' ')
Remove leading and trailing characters from string.

References G4VViewer::fName, G4VViewer::fShortName, G4InuclParticleNames::name(), and G4StrUtil::strip().

◆ SetNeedKernelVisit()

void G4VViewer::SetNeedKernelVisit ( G4bool  need)
inherited

◆ SetTouchable()

void G4VViewer::SetTouchable ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath)
protectedinherited

Definition at line 124 of file G4VViewer.cc.

126{
127 // Set the touchable for /vis/touchable/set/... commands.
128 std::ostringstream oss;
129 const auto& pvStore = G4PhysicalVolumeStore::GetInstance();
130 for (const auto& pvNodeId: fullPath) {
131 const auto& pv = pvNodeId.GetPhysicalVolume();
132 auto iterator = find(pvStore->begin(),pvStore->end(),pv);
133 if (iterator == pvStore->end()) {
135 ed << "Volume no longer in physical volume store.";
136 G4Exception("G4VViewer::SetTouchable", "visman0501", JustWarning, ed);
137 } else {
138 oss
139 << ' ' << pvNodeId.GetPhysicalVolume()->GetName()
140 << ' ' << pvNodeId.GetCopyNo();
141 }
142 }
143 G4UImanager::GetUIpointer()->ApplyCommand("/vis/set/touchable" + oss.str());
144}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4PhysicalVolumeStore * GetInstance()
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:485
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77

References G4UImanager::ApplyCommand(), G4Exception(), G4PhysicalVolumeStore::GetInstance(), G4UImanager::GetUIpointer(), and JustWarning.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency(), and G4OpenGLQtViewer::setCheckComponent().

◆ SetView()

void G4OpenGLXViewer::SetView ( )
virtualinherited

◆ SetViewParameters()

void G4VViewer::SetViewParameters ( const G4ViewParameters vp)
inherited

◆ ShowView()

void G4OpenGLXViewer::ShowView ( void  )
virtualinherited

Reimplemented from G4VViewer.

Definition at line 104 of file G4OpenGLXViewer.cc.

104 {
105#ifdef G4MULTITHREADED
106// G4int thread_id = G4Threading::G4GetThreadId();
107// G4cout << "G4OpenGLXViewer::ShowView: thread " << thread_id << G4endl;
108#endif
109
110// glXWaitGL (); //Wait for effects of all previous OpenGL commands to
111 //be propagated before progressing.
112// JA: Commented out July 2021 - slows rendering down in some cases and I
113// don't see any adverse effects.
114
115 glFlush ();
116
117 if (fVP.IsPicking()) {
118 G4cout <<
119 "Window activated for picking (left-mouse), exit (middle-mouse)."
120 << G4endl;
121 while (true) {
122 if (XPending(dpy)) {
123 XNextEvent(dpy, &event);
124 if (event.type == ButtonPress && event.xbutton.button == 1) {
125 G4cout << Pick(event.xbutton.x, event.xbutton.y) << G4endl;
126 }
127 else if (event.type == ButtonPress && event.xbutton.button == 2) break;
128 }
129 std::this_thread::sleep_for(std::chrono::milliseconds(100));
130 }
131 }
132}
virtual G4String Pick(GLdouble x, GLdouble y)

References G4OpenGLXViewer::dpy, G4OpenGLXViewer::event, G4VViewer::fVP, G4cout, G4endl, G4ViewParameters::IsPicking(), and G4OpenGLViewer::Pick().

◆ sizeHasChanged()

G4bool G4OpenGLViewer::sizeHasChanged ( )
protectedinherited

◆ TOSelected()

virtual G4bool G4OpenGLStoredViewer::TOSelected ( size_t  )
inlineprotectedvirtualinherited

Reimplemented in G4OpenGLStoredQtViewer.

Definition at line 68 of file G4OpenGLStoredViewer.hh.

68{return true;}

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ TouchableSetColour()

void G4VViewer::TouchableSetColour ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
const G4Colour colour 
)
protectedinherited

Definition at line 180 of file G4VViewer.cc.

183{
184 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
185
186 std::ostringstream oss;
187 oss << "/vis/touchable/set/colour "
188 << colour.GetRed() << ' ' << colour.GetGreen()
189 << ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
190
191 // The following is equivalent to
192 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
193 // (assuming the touchable has already been set), but avoids view rebuild.
194
195 // Instantiate a working copy of a G4VisAttributes object...
196 G4VisAttributes workingVisAtts;
197 // and set the colour.
198 workingVisAtts.SetColour(colour);
199
202 (workingVisAtts,
205 // G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
206 // signifies that it is the colour that should be picked out
207 // and merged with the touchable's normal vis attributes.
208
209 // Record on G4cout (with #) for information.
210 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
211 G4cout << "# " << oss.str() << G4endl;
212 }
213}
static G4ModelingParameters::PVNameCopyNoPath GetPVNameCopyNoPath(const std::vector< G4PhysicalVolumeNodeID > &)
void AddVisAttributesModifier(const G4ModelingParameters::VisAttributesModifier &)
void SetColour(const G4Colour &)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4Colour::GetAlpha(), G4Colour::GetBlue(), G4Colour::GetGreen(), G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4Colour::GetRed(), G4UImanager::GetUIpointer(), G4VisAttributes::SetColour(), and G4ModelingParameters::VASColour.

Referenced by G4OpenGLQtViewer::changeColorAndTransparency().

◆ TouchableSetVisibility()

void G4VViewer::TouchableSetVisibility ( const std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > &  fullPath,
G4bool  visibility 
)
protectedinherited

Definition at line 146 of file G4VViewer.cc.

149{
150 // Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
151
152 std::ostringstream oss;
153 oss << "/vis/touchable/set/visibility ";
154 if (visibiity) oss << "true"; else oss << "false";
155
156 // The following is equivalent to
157 // G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
158 // (assuming the touchable has already been set), but avoids view rebuild.
159
160 // Instantiate a working copy of a G4VisAttributes object...
161 G4VisAttributes workingVisAtts;
162 // and set the visibility.
163 workingVisAtts.SetVisibility(visibiity);
164
167 (workingVisAtts,
170 // G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
171 // signifies that it is the visibility that should be picked out
172 // and merged with the touchable's normal vis attributes.
173
174 // Record on G4cout (with #) for information.
175 if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
176 G4cout << "# " << oss.str() << G4endl;
177 }
178}
void SetVisibility(G4bool=true)

References G4ViewParameters::AddVisAttributesModifier(), G4VViewer::fVP, G4cout, G4endl, G4PhysicalVolumeModel::GetPVNameCopyNoPath(), G4UImanager::GetUIpointer(), G4VisAttributes::SetVisibility(), and G4ModelingParameters::VASVisibility.

Referenced by G4OpenGLQtViewer::setCheckComponent().

Field Documentation

◆ antialiasing_enabled

G4bool G4OpenGLViewer::antialiasing_enabled
protectedinherited

◆ attributeList

G4int* G4OpenGLXViewer::attributeList
protectedinherited

Definition at line 89 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ background

G4Colour G4OpenGLViewer::background
protectedinherited

◆ charViewName

char G4OpenGLXViewer::charViewName[100]
protectedinherited

Definition at line 102 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ class_hints

XClassHint* G4OpenGLXViewer::class_hints
protectedinherited

Definition at line 96 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ cmap

Colormap G4OpenGLXViewer::cmap
protectedinherited

◆ cxMaster

GLXContext G4OpenGLXViewer::cxMaster
protectedinherited

◆ dblBuf_RGBA

int G4OpenGLXViewer::dblBuf_RGBA
staticprotectedinherited
Initial value:
=
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None }

Definition at line 70 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ dpy

Display* G4OpenGLXViewer::dpy
protectedinherited

◆ errorBase

G4int G4OpenGLXViewer::errorBase
protectedinherited

◆ event

XEvent G4OpenGLXViewer::event
protectedinherited

◆ eventBase

G4int G4OpenGLXViewer::eventBase
protectedinherited

◆ fDefaultExportFilename

G4String G4OpenGLViewer::fDefaultExportFilename
privateinherited

Definition at line 220 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::G4OpenGLViewer().

◆ fDefaultExportImageFormat

std::string G4OpenGLViewer::fDefaultExportImageFormat
protectedinherited

Definition at line 210 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLQtViewer::actionSaveImage().

◆ fDefaultVP

G4ViewParameters G4VViewer::fDefaultVP
protectedinherited

◆ fDepthTestEnable

G4bool G4OpenGLStoredViewer::fDepthTestEnable
protectedinherited

Definition at line 70 of file G4OpenGLStoredViewer.hh.

Referenced by G4OpenGLStoredViewer::DrawDisplayLists().

◆ fExportFilename

G4String G4OpenGLViewer::fExportFilename
privateinherited

◆ fExportFilenameIndex

int G4OpenGLViewer::fExportFilenameIndex
protectedinherited

◆ fExportImageFormat

std::string G4OpenGLViewer::fExportImageFormat
protectedinherited

◆ fExportImageFormatVector

std::vector< std::string > G4OpenGLViewer::fExportImageFormatVector
protectedinherited

◆ fG4OpenGLStoredSceneHandler

G4OpenGLStoredSceneHandler& G4OpenGLStoredViewer::fG4OpenGLStoredSceneHandler
protectedinherited

◆ fGL2PSAction

G4OpenGL2PSAction* G4OpenGLViewer::fGL2PSAction
protectedinherited

◆ fGl2psDefaultLineWith

int G4OpenGLViewer::fGl2psDefaultLineWith
privateinherited

Definition at line 222 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGl2psDefaultPointSize

int G4OpenGLViewer::fGl2psDefaultPointSize
privateinherited

Definition at line 223 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::printGl2PS().

◆ fGlViewInitialized

bool G4OpenGLViewer::fGlViewInitialized
privateinherited

Definition at line 224 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::InitializeGLView().

◆ fIsGettingPickInfos

bool G4OpenGLViewer::fIsGettingPickInfos
privateinherited

Definition at line 241 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails(), and G4OpenGLViewer::SetView().

◆ fLastVP

G4ViewParameters G4OpenGLStoredViewer::fLastVP
protectedinherited

◆ fName

G4String G4VViewer::fName
protectedinherited

◆ fNeedKernelVisit

G4bool G4VViewer::fNeedKernelVisit
protectedinherited

◆ fOldDisplayListColor

G4Colour G4OpenGLStoredViewer::fOldDisplayListColor
protectedinherited

Definition at line 71 of file G4OpenGLStoredViewer.hh.

◆ fOpenGLSceneHandler

G4OpenGLSceneHandler& G4OpenGLViewer::fOpenGLSceneHandler
protectedinherited

Definition at line 197 of file G4OpenGLViewer.hh.

Referenced by G4OpenGLViewer::GetPickDetails().

◆ fPan_sens

G4double G4OpenGLViewer::fPan_sens
protectedinherited

◆ fPointSize

G4float G4OpenGLViewer::fPointSize
privateinherited

Definition at line 218 of file G4OpenGLViewer.hh.

◆ fPrintColour

G4bool G4OpenGLViewer::fPrintColour
protectedinherited

◆ fPrintSizeX

G4int G4OpenGLViewer::fPrintSizeX
protectedinherited

◆ fPrintSizeY

G4int G4OpenGLViewer::fPrintSizeY
protectedinherited

◆ fRot_sens

G4double G4OpenGLViewer::fRot_sens
protectedinherited

◆ fSceneHandler

G4VSceneHandler& G4VViewer::fSceneHandler
protectedinherited

◆ fShortName

G4String G4VViewer::fShortName
protectedinherited

◆ fSizeHasChanged

G4bool G4OpenGLViewer::fSizeHasChanged
privateinherited

◆ fVectoredPs

G4bool G4OpenGLViewer::fVectoredPs
protectedinherited

◆ fViewId

G4int G4VViewer::fViewId
protectedinherited

◆ fVP

G4ViewParameters G4VViewer::fVP
protectedinherited

Definition at line 219 of file G4VViewer.hh.

Referenced by G4OpenGLQtViewer::actionChangeBackgroundColor(), G4OpenGLQtViewer::actionChangeDefaultColor(), G4OpenGLQtViewer::actionChangeTextColor(), G4OpenGLXmViewer::actions_callback(), G4OpenGLSceneHandler::AddPrimitive(), G4OpenGLImmediateSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal(), G4OpenGLXmViewer::aux_edge_callback(), G4OpenGLQtViewer::changeDepthInSceneTree(), G4OpenGLStoredQtViewer::CompareForKernelVisit(), G4OpenGLStoredViewer::CompareForKernelVisit(), G4OpenInventorViewer::CompareForKernelVisit(), G4Qt3DViewer::CompareForKernelVisit(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::CompareForKernelVisit(), G4OpenGLStoredQtViewer::ComputeView(), G4OpenGLWin32Viewer::CreateMainWindow(), G4OpenGLXmViewer::CreateMainWindow(), G4OpenGLXViewer::CreateMainWindow(), G4OpenGLQtViewer::CreateMainWindow(), G4OpenGLQtViewer::createPopupMenu(), G4OpenGLXmViewer::dolly_callback(), G4OpenGLStoredViewer::DrawDisplayLists(), G4OpenGLXmViewer::drawing_style_callback(), G4OpenGLStoredWin32Viewer::DrawView(), G4OpenGLStoredXmViewer::DrawView(), DrawView(), G4OpenInventorViewer::DrawView(), G4Qt3DViewer::DrawView(), G4RayTracerViewer::DrawView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::DrawView(), G4VtkViewer::DrawViewHUD(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Export(), G4ASCIITreeViewer::G4ASCIITreeViewer(), G4HepRepFileViewer::G4HepRepFileViewer(), G4OpenGLQtViewer::G4keyPressEvent(), G4OpenGLQtViewer::G4MouseMoveEvent(), G4OpenGLQtViewer::G4MousePressEvent(), G4OpenGLQtViewer::G4MouseReleaseEvent(), G4OpenGLViewer::G4OpenGLViewer(), G4OpenInventorViewer::G4OpenInventorViewer(), G4VtkViewer::G4VtkViewer(), G4VViewer::G4VViewer(), G4OpenGLQtViewer::G4wheelEvent(), G4OpenGLViewer::getSceneDepth(), G4OpenGLViewer::getSceneFarWidth(), G4OpenGLViewer::getSceneNearWidth(), G4OpenGLXmViewer::GetXmConnection(), G4OpenInventorViewer::GroupCameraSensorCB(), G4OpenInventorQtViewer::Initialise(), G4OpenInventorWinViewer::Initialise(), G4OpenInventorXtExtendedViewer::Initialise(), G4OpenInventorXtViewer::Initialise(), G4Qt3DViewer::Initialise(), G4RayTracerViewer::Initialise(), G4RayTracerXViewer::Initialise(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::Initialise(), G4VtkQtViewer::Initialise(), G4VtkViewer::Initialise(), G4OpenGLViewer::InitializeGLView(), G4OpenGLXmViewer::left_right_pan_callback(), G4OpenGLXmViewer::misc_callback(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::mouse_move(), G4Qt3DViewer::mouseMoveEvent(), G4OpenGLQtViewer::moveScene(), G4OpenGLImmediateViewer::ProcessView(), G4OpenGLXmViewer::projection_callback(), G4OpenGLXmViewer::reset_callback(), G4OpenGLXmViewer::ResetView(), G4OpenGLViewer::rotateScene(), G4OpenGLViewer::rotateSceneInViewDirection(), G4OpenGLViewer::rotateSceneThetaPhi(), G4OpenGLViewer::rotateSceneToggle(), G4DAWNFILEViewer::SendDrawingStyleToDAWNGUI(), G4DAWNFILEViewer::SendViewParameters(), G4VRML2FileViewer::SendViewParameters(), G4OpenGLXmViewer::set_rot_subject_callback(), G4OpenGLViewerMessenger::SetNewValue(), G4OpenGLXmViewerMessenger::SetNewValue(), G4OpenGLWin32Viewer::SetRotation(), G4OpenGLWin32Viewer::SetShift(), G4OpenGLViewer::SetView(), G4OpenInventorQtViewer::SetView(), G4OpenInventorViewer::SetView(), G4OpenInventorWinViewer::SetView(), G4OpenInventorXtExtendedViewer::SetView(), G4OpenInventorXtViewer::SetView(), G4Qt3DViewer::SetView(), G4RayTracerViewer::SetView(), G4ToolsSGQtViewer::SetView(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::SetView(), G4VtkViewer::SetView(), G4VViewer::SetViewParameters(), G4OpenGLWin32Viewer::SetZoom(), G4OpenGLXViewer::ShowView(), G4VtkViewer::ShowView(), G4OpenGLQtViewer::toggleAux(), G4OpenGLQtViewer::toggleHiddenMarkers(), G4OpenGLQtViewer::togglePicking(), G4OpenGLQtViewer::toggleProjection(), G4OpenGLQtViewer::toggleSurfaceAction(), G4VViewer::TouchableSetColour(), G4VViewer::TouchableSetVisibility(), G4OpenGLXmViewer::up_down_pan_callback(), G4OpenGLXmViewer::update_panels_callback(), G4OpenGLXmViewer::UpdateControlPanel(), G4OpenGLQtViewer::updateToolbarAndMouseContextMenu(), G4OpenGLQtViewer::updateViewerPropertiesTableWidget(), G4ToolsSGViewer< SG_SESSION, SG_VIEWER >::wheel_rotate(), G4Qt3DViewer::wheelEvent(), G4OpenGLXmViewer::wobble_callback(), G4OpenGLXmViewer::wobble_timer_callback(), and G4OpenGLXmViewer::zoom_callback().

◆ fWinSize_x

unsigned int G4OpenGLViewer::fWinSize_x
protectedinherited

◆ fWinSize_y

unsigned int G4OpenGLViewer::fWinSize_y
protectedinherited

◆ haloing_enabled

G4bool G4OpenGLViewer::haloing_enabled
protectedinherited

◆ icon_pixmap

Pixmap G4OpenGLXViewer::icon_pixmap
protectedinherited

Definition at line 97 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ iconName

XTextProperty G4OpenGLXViewer::iconName
protectedinherited

◆ major

G4int G4OpenGLXViewer::major
protectedinherited

Definition at line 92 of file G4OpenGLXViewer.hh.

◆ minor

G4int G4OpenGLXViewer::minor
protectedinherited

Definition at line 93 of file G4OpenGLXViewer.hh.

◆ norm_hints

XSizeHints* G4OpenGLXViewer::norm_hints
protectedinherited

Definition at line 94 of file G4OpenGLXViewer.hh.

◆ size_hints

XSizeHints* G4OpenGLXViewer::size_hints
protectedinherited

Definition at line 98 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ snglBuf_RGBA

int G4OpenGLXViewer::snglBuf_RGBA
staticprotectedinherited
Initial value:
=
{ GLX_RGBA,
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None }

Definition at line 69 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ swa

XSetWindowAttributes G4OpenGLXViewer::swa
protectedinherited

Definition at line 82 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ tmp_cx

GLXContext G4OpenGLXViewer::tmp_cx
privateinherited

Definition at line 108 of file G4OpenGLXViewer.hh.

◆ transparency_enabled

G4bool G4OpenGLViewer::transparency_enabled
protectedinherited

◆ vi

XVisualInfo * G4OpenGLXViewer::vi
protectedinherited

◆ vi_double_buffer

XVisualInfo * G4OpenGLXViewer::vi_double_buffer = 0
staticprotectedinherited

Definition at line 77 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ vi_immediate

XVisualInfo* G4OpenGLXViewer::vi_immediate
protectedinherited

◆ vi_single_buffer

XVisualInfo * G4OpenGLXViewer::vi_single_buffer = 0
staticprotectedinherited

Definition at line 76 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::G4OpenGLXViewer().

◆ vi_stored

XVisualInfo * G4OpenGLXViewer::vi_stored
protectedinherited

◆ win

GLXDrawable G4OpenGLXViewer::win
protectedinherited

◆ windowName

XTextProperty G4OpenGLXViewer::windowName
protectedinherited

◆ wm_hints

XWMHints* G4OpenGLXViewer::wm_hints
protectedinherited

Definition at line 95 of file G4OpenGLXViewer.hh.

Referenced by G4OpenGLXViewer::CreateMainWindow().

◆ Xatom

Atom G4OpenGLXViewer::Xatom
protectedinherited

Definition at line 99 of file G4OpenGLXViewer.hh.

◆ xwa

XWindowAttributes G4OpenGLXViewer::xwa
protectedinherited

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