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

#include <G4OpenGLStoredSceneHandler.hh>

+ Inheritance diagram for G4OpenGLStoredSceneHandler:

Classes

struct  G4TextPlus
 
struct  PO
 
struct  TO
 

Public Member Functions

 G4OpenGLStoredSceneHandler (G4VGraphicsSystem &system, const G4String &name="")
 
virtual ~G4OpenGLStoredSceneHandler ()
 
void BeginPrimitives (const G4Transform3D &objectTransformation)
 
void EndPrimitives ()
 
void BeginPrimitives2D (const G4Transform3D &objectTransformation)
 
void EndPrimitives2D ()
 
void BeginModeling ()
 
void EndModeling ()
 
void AddPrimitive (const G4Polyline &)
 
void AddPrimitive (const G4Polymarker &)
 
void AddPrimitive (const G4Circle &)
 
void AddPrimitive (const G4Square &)
 
void AddPrimitive (const G4Text &)
 
void AddPrimitive (const G4Polyhedron &)
 
void ClearStore ()
 
void ClearTransientStore ()
 
virtual void AddPrimitive (const G4Plotter &)
 
- Public Member Functions inherited from G4OpenGLSceneHandler
void AddPrimitivesCircle (const std::vector< G4VMarker > &)
 
void AddPrimitivesSquare (const std::vector< G4VMarker > &)
 
void PreAddSolid (const G4Transform3D &objectTransformation, const G4VisAttributes &)
 
void AddSolid (const G4Box &)
 
void AddSolid (const G4Cons &)
 
void AddSolid (const G4Tubs &)
 
void AddSolid (const G4Trd &)
 
void AddSolid (const G4Trap &)
 
void AddSolid (const G4Sphere &)
 
void AddSolid (const G4Para &)
 
void AddSolid (const G4Torus &)
 
void AddSolid (const G4Polycone &)
 
void AddSolid (const G4Polyhedra &)
 
void AddSolid (const G4Orb &)
 
void AddSolid (const G4Ellipsoid &)
 
void AddSolid (const G4TessellatedSolid &)
 
void AddSolid (const G4VSolid &)
 
void AddCompound (const G4VTrajectory &)
 
void AddCompound (const G4VHit &)
 
void AddCompound (const G4VDigi &)
 
void AddCompound (const G4THitsMap< G4double > &)
 
void AddCompound (const G4THitsMap< G4StatDouble > &)
 
void AddCompound (const G4Mesh &)
 
- Public Member Functions inherited from G4VSceneHandler
 G4VSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4VSceneHandler ()
 
virtual void PostAddSolid ()
 
virtual const G4VisExtentGetExtent () const
 
const G4StringGetName () const
 
G4int GetSceneHandlerId () const
 
G4int GetViewCount () const
 
G4VGraphicsSystemGetGraphicsSystem () const
 
G4SceneGetScene () const
 
const G4ViewerListGetViewerList () const
 
G4VModelGetModel () const
 
G4VViewerGetCurrentViewer () const
 
G4bool GetMarkForClearingTransientStore () const
 
G4bool IsReadyForTransients () const
 
G4bool GetTransientsDrawnThisEvent () const
 
G4bool GetTransientsDrawnThisRun () const
 
const G4Transform3DGetObjectTransformation () const
 
void SetName (const G4String &)
 
void SetCurrentViewer (G4VViewer *)
 
virtual void SetScene (G4Scene *)
 
G4ViewerListSetViewerList ()
 
void SetModel (G4VModel *)
 
void SetMarkForClearingTransientStore (G4bool)
 
void SetTransientsDrawnThisEvent (G4bool)
 
void SetTransientsDrawnThisRun (G4bool)
 
void SetObjectTransformation (const G4Transform3D &)
 
const G4ColourGetColour ()
 
const G4ColourGetColor ()
 
const G4ColourGetColour (const G4Visible &)
 
const G4ColourGetColor (const G4Visible &)
 
const G4ColourGetTextColour (const G4Text &)
 
const G4ColourGetTextColor (const G4Text &)
 
G4double GetLineWidth (const G4VisAttributes *)
 
G4ViewParameters::DrawingStyle GetDrawingStyle (const G4VisAttributes *)
 
G4int GetNumberOfCloudPoints (const G4VisAttributes *) const
 
G4bool GetAuxEdgeVisible (const G4VisAttributes *)
 
G4int GetNoOfSides (const G4VisAttributes *)
 
G4double GetMarkerSize (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerDiameter (const G4VMarker &, MarkerSizeType &)
 
G4double GetMarkerRadius (const G4VMarker &, MarkerSizeType &)
 
G4ModelingParametersCreateModelingParameters ()
 
void DrawEvent (const G4Event *)
 
void DrawEndOfRunModels ()
 
template<class T >
void AddSolidT (const T &solid)
 
template<class T >
void AddSolidWithAuxiliaryEdges (const T &solid)
 
G4int IncrementViewCount ()
 
void AddViewerToList (G4VViewer *pView)
 
void RemoveViewerFromList (G4VViewer *pView)
 
- Public Member Functions inherited from G4VGraphicsScene
 G4VGraphicsScene ()
 
virtual ~G4VGraphicsScene ()
 

Protected Member Functions

G4bool AddPrimitivePreamble (const G4VMarker &visible)
 
G4bool AddPrimitivePreamble (const G4Polyline &visible)
 
G4bool AddPrimitivePreamble (const G4Polyhedron &visible)
 
void AddPrimitivePostamble ()
 
virtual G4bool ExtraPOProcessing (const G4Visible &, size_t)
 
virtual G4bool ExtraTOProcessing (const G4Visible &, size_t)
 
- Protected Member Functions inherited from G4OpenGLSceneHandler
 G4OpenGLSceneHandler (G4VGraphicsSystem &system, G4int id, const G4String &name="")
 
virtual ~G4OpenGLSceneHandler ()
 
void ProcessScene ()
 
G4DisplacedSolidCreateSectionSolid ()
 
G4DisplacedSolidCreateCutawaySolid ()
 
void ClearAndDestroyAtts ()
 
void ScaledFlush ()
 
- Protected Member Functions inherited from G4VSceneHandler
virtual void RequestPrimitives (const G4VSolid &solid)
 
void LoadAtts (const G4Visible &, G4AttHolder *)
 
void StandardSpecialMeshRendering (const G4Mesh &)
 
void Draw3DRectMeshAsDots (const G4Mesh &)
 
void Draw3DRectMeshAsSurfaces (const G4Mesh &)
 
void DrawTetMeshAsDots (const G4Mesh &)
 
void DrawTetMeshAsSurfaces (const G4Mesh &)
 
G4ThreeVector GetPointInBox (const G4ThreeVector &pos, G4double halfX, G4double halfY, G4double halfZ) const
 
G4ThreeVector GetPointInTet (const std::vector< G4ThreeVector > &vertices) const
 

Protected Attributes

G4bool fDoNotUseDisplayList
 
GLint fTopPODL
 
std::vector< POfPOList
 
std::vector< TOfTOList
 
std::map< const G4VSolid *, G4int, std::less< const G4VSolid * > > fSolidMap
 
- Protected Attributes inherited from G4OpenGLSceneHandler
GLuint fPickName
 
std::map< GLuint, G4AttHolder * > fPickMap
 
G4bool fThreePassCapable
 
G4bool fSecondPassForTransparencyRequested
 
G4bool fSecondPassForTransparency
 
G4bool fThirdPassForNonHiddenMarkersRequested
 
G4bool fThirdPassForNonHiddenMarkers
 
bool fEdgeFlag
 
- Protected Attributes inherited from G4VSceneHandler
G4VGraphicsSystemfSystem
 
const G4int fSceneHandlerId
 
G4String fName
 
G4int fViewCount
 
G4ViewerList fViewerList
 
G4VViewerfpViewer
 
G4ScenefpScene
 
G4bool fMarkForClearingTransientStore
 
G4bool fReadyForTransients
 
G4bool fTransientsDrawnThisEvent
 
G4bool fTransientsDrawnThisRun
 
G4bool fProcessingSolid
 
G4bool fProcessing2D
 
G4VModelfpModel
 
G4Transform3D fObjectTransformation
 
G4int fNestingDepth
 
const G4VisAttributesfpVisAttribs
 
const G4Transform3D fIdentityTransformation
 

Static Protected Attributes

static G4int fSceneIdCount = 0
 
static G4int fDisplayListId = 0
 
- Static Protected Attributes inherited from G4OpenGLSceneHandler
static FlushAction fFlushAction = G4OpenGLSceneHandler::NthEvent
 
static G4int fEntitiesFlushInterval = 100
 
static const GLubyte fStippleMaskHashed [128]
 

Friends

class G4OpenGLStoredViewer
 

Additional Inherited Members

- Public Types inherited from G4OpenGLSceneHandler
enum  FlushAction {
  endOfEvent , endOfRun , eachPrimitive , NthPrimitive ,
  NthEvent , never
}
 
- Public Types inherited from G4VSceneHandler
enum  MarkerSizeType { world , screen }
 
- Static Public Member Functions inherited from G4OpenGLSceneHandler
static G4int GetEntitiesFlushInterval ()
 
static FlushAction GetFlushAction ()
 
static void SetEntitiesFlushInterval (G4int interval)
 
static void SetFlushAction (FlushAction action)
 

Detailed Description

Definition at line 43 of file G4OpenGLStoredSceneHandler.hh.

Constructor & Destructor Documentation

◆ G4OpenGLStoredSceneHandler()

G4OpenGLStoredSceneHandler::G4OpenGLStoredSceneHandler ( G4VGraphicsSystem & system,
const G4String & name = "" )

Definition at line 147 of file G4OpenGLStoredSceneHandler.cc.

149 :
150G4OpenGLSceneHandler (system, fSceneIdCount++, name),
152fTopPODL (0)
153{}
G4OpenGLSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")

◆ ~G4OpenGLStoredSceneHandler()

G4OpenGLStoredSceneHandler::~G4OpenGLStoredSceneHandler ( )
virtual

Definition at line 155 of file G4OpenGLStoredSceneHandler.cc.

156{}

Member Function Documentation

◆ AddPrimitive() [1/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Circle & circle)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 451 of file G4OpenGLStoredSceneHandler.cc.

452{
453 G4bool furtherprocessing = AddPrimitivePreamble(circle);
454 if (furtherprocessing) {
457 }
458}
bool G4bool
Definition G4Types.hh:86
void AddPrimitive(const G4Polyline &)
G4bool AddPrimitivePreamble(const G4VMarker &visible)

◆ AddPrimitive() [2/7]

void G4VSceneHandler::AddPrimitive ( const G4Plotter & )
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 193 of file G4VSceneHandler.cc.

512 {
513 G4warn << "WARNING: Plotter not implemented for " << fSystem.GetName() << G4endl;
514 G4warn << " Open a plotter-aware graphics system or remove plotter with" << G4endl;
515 G4warn << " /vis/scene/removeModel Plotter" << G4endl;
516}
#define G4warn
Definition G4Scene.cc:41
#define G4endl
Definition G4ios.hh:67
const G4String & GetName() const
G4VGraphicsSystem & fSystem

◆ AddPrimitive() [3/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Polyhedron & polyhedron)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 469 of file G4OpenGLStoredSceneHandler.cc.

470{
471 // Note: colour is still handled in
472 // G4OpenGLSceneHandler::AddPrimitive(const G4Polyhedron&), so it still
473 // gets into the display list
474 G4bool furtherprocessing = AddPrimitivePreamble(polyhedron);
475 if (furtherprocessing) {
478 }
479}

◆ AddPrimitive() [4/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Polyline & polyline)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 421 of file G4OpenGLStoredSceneHandler.cc.

422{
423 G4bool furtherprocessing = AddPrimitivePreamble(polyline);
424 if (furtherprocessing) {
427 }
428}

◆ AddPrimitive() [5/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Polymarker & polymarker)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 430 of file G4OpenGLStoredSceneHandler.cc.

431{
432 G4bool furtherprocessing = AddPrimitivePreamble(polymarker);
433 if (furtherprocessing) {
436 }
437}

◆ AddPrimitive() [6/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Square & square)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 460 of file G4OpenGLStoredSceneHandler.cc.

461{
462 G4bool furtherprocessing = AddPrimitivePreamble(square);
463 if (furtherprocessing) {
466 }
467}

◆ AddPrimitive() [7/7]

void G4OpenGLStoredSceneHandler::AddPrimitive ( const G4Text & text)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 439 of file G4OpenGLStoredSceneHandler.cc.

440{
441 // Note: colour is still handled in
442 // G4OpenGLSceneHandler::AddPrimitive(const G4Text&), so it still
443 // gets into the display list
444 G4bool furtherprocessing = AddPrimitivePreamble(text);
445 if (furtherprocessing) {
448 }
449}

◆ AddPrimitivePostamble()

void G4OpenGLStoredSceneHandler::AddPrimitivePostamble ( )
protected

Definition at line 390 of file G4OpenGLStoredSceneHandler.cc.

391{
392 if (fProcessing2D) {
393 // Pop current 3D world matrices back again...
394 glMatrixMode (GL_PROJECTION);
395 glPopMatrix();
396 glMatrixMode (GL_MODELVIEW);
397 glPopMatrix();
398 }
399
400 // if ((glGetError() == GL_TABLE_TOO_LARGE) || (glGetError() == GL_OUT_OF_MEMORY)) { // Could close?
401 if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
402 G4cerr <<
403 "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure"
404 " to allocate display List for fTopPODL - try OpenGL Immediated mode."
405 << G4endl;
406 }
408 glEndList();
409 if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
410 G4cerr <<
411 "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure"
412 " to allocate display List for fTopPODL - try OpenGL Immediated mode."
413 << G4endl;
414 }
415 }
417 glPopMatrix();
418 }
419}
G4GLOB_DLL std::ostream G4cerr

Referenced by AddPrimitive(), AddPrimitive(), AddPrimitive(), AddPrimitive(), AddPrimitive(), and AddPrimitive().

◆ AddPrimitivePreamble() [1/3]

G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble ( const G4Polyhedron & visible)
protected

Definition at line 197 of file G4OpenGLStoredSceneHandler.cc.

198{
199 return AddPrimitivePreambleInternal(visible, false, false);
200}

◆ AddPrimitivePreamble() [2/3]

G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble ( const G4Polyline & visible)
protected

Definition at line 193 of file G4OpenGLStoredSceneHandler.cc.

194{
195 return AddPrimitivePreambleInternal(visible, false, true);
196}

◆ AddPrimitivePreamble() [3/3]

G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreamble ( const G4VMarker & visible)
protected

Definition at line 189 of file G4OpenGLStoredSceneHandler.cc.

190{
191 return AddPrimitivePreambleInternal(visible, true, false);
192}

Referenced by AddPrimitive(), AddPrimitive(), AddPrimitive(), AddPrimitive(), AddPrimitive(), and AddPrimitive().

◆ BeginModeling()

void G4OpenGLStoredSceneHandler::BeginModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 481 of file G4OpenGLStoredSceneHandler.cc.

481 {
483 /* Debug...
484 fDisplayListId = glGenLists (1);
485 G4cout << "OGL::fDisplayListId (start): " << fDisplayListId << G4endl;
486 */
487}
virtual void BeginModeling()

◆ BeginPrimitives()

void G4OpenGLStoredSceneHandler::BeginPrimitives ( const G4Transform3D & objectTransformation)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 158 of file G4OpenGLStoredSceneHandler.cc.

160{
161 G4OpenGLSceneHandler::BeginPrimitives (objectTransformation);
162 if (fReadyForTransients) glDrawBuffer (GL_FRONT);
163 // Display list setup moved to AddPrimitivePreamble. See notes there.
164}
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)

◆ BeginPrimitives2D()

void G4OpenGLStoredSceneHandler::BeginPrimitives2D ( const G4Transform3D & objectTransformation)
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 174 of file G4OpenGLStoredSceneHandler.cc.

176{
177 G4OpenGLSceneHandler::BeginPrimitives2D(objectTransformation);
178 if (fReadyForTransients) glDrawBuffer (GL_FRONT);
179}
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)

◆ ClearStore()

void G4OpenGLStoredSceneHandler::ClearStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 523 of file G4OpenGLStoredSceneHandler.cc.

523 {
524
525 //G4cout << "G4OpenGLStoredSceneHandler::ClearStore" << G4endl;
526
527 G4VSceneHandler::ClearStore (); // Sets need kernel visit, etc.
528
529 // Delete OpenGL permanent display lists.
530 for (size_t i = 0; i < fPOList.size (); i++)
531 glDeleteLists (fPOList[i].fDisplayListId, 1);
532 if (fTopPODL) glDeleteLists (fTopPODL, 1);
533 fTopPODL = 0;
534
535 // Clear other lists, dictionary, etc.
536 fPOList.clear ();
537 fSolidMap.clear ();
539
540 // ...and clear transient store...
541 for (size_t i = 0; i < fTOList.size (); i++)
542 glDeleteLists(fTOList[i].fDisplayListId, 1);
543 fTOList.clear ();
544}
std::map< const G4VSolid *, G4int, std::less< const G4VSolid * > > fSolidMap
virtual void ClearStore()

Referenced by G4OpenGLStoredQtSceneHandler::ClearStore().

◆ ClearTransientStore()

void G4OpenGLStoredSceneHandler::ClearTransientStore ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 546 of file G4OpenGLStoredSceneHandler.cc.

547{
548 //G4cout << "G4OpenGLStoredSceneHandler::ClearTransientStore" << G4endl;
549
550 // Delete OpenGL transient display lists and Transient Objects themselves.
551 for (size_t i = 0; i < fTOList.size (); i++)
552 glDeleteLists(fTOList[i].fDisplayListId, 1);
553 fTOList.clear ();
554
555 // Redraw the scene ready for the next event.
556 if (fpViewer) {
557 fpViewer -> SetView ();
558 fpViewer -> ClearView ();
559 fpViewer -> DrawView ();
560 }
561}

Referenced by G4OpenGLStoredQtSceneHandler::ClearTransientStore().

◆ EndModeling()

void G4OpenGLStoredSceneHandler::EndModeling ( )
virtual

Reimplemented from G4VSceneHandler.

Definition at line 489 of file G4OpenGLStoredSceneHandler.cc.

489 {
490 // Make a List which calls the other lists.
491 fTopPODL = glGenLists (1);
492 if (glGetError() == GL_OUT_OF_MEMORY) { // Could pre-allocate?
493 G4cerr <<
494 "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
495 " display List for fTopPODL - try OpenGL Immediated mode."
496 << G4endl;
497 } else {
498
499 glNewList (fTopPODL, GL_COMPILE); {
500 for (size_t i = 0; i < fPOList.size (); i++) {
501 glPushMatrix();
502 G4OpenGLTransform3D oglt (fPOList[i].fTransform);
503 glMultMatrixd (oglt.GetGLMatrix ());
505 glLoadName(fPOList[i].fPickName);
506 glCallList (fPOList[i].fDisplayListId);
507 glPopMatrix();
508 }
509 }
510 glEndList ();
511
512 if (glGetError() == GL_OUT_OF_MEMORY) { // Could close?
513 G4cerr <<
514 "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
515 " display List for fTopPODL - try OpenGL Immediated mode."
516 << G4endl;
517 }
518 }
519
521}
virtual void EndModeling()
const G4ViewParameters & GetViewParameters() const
G4bool IsPicking() const

◆ EndPrimitives()

void G4OpenGLStoredSceneHandler::EndPrimitives ( )
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 166 of file G4OpenGLStoredSceneHandler.cc.

167{
168 // See all primitives immediately... At least soon...
169 ScaledFlush();
170 glDrawBuffer (GL_BACK);
172}

◆ EndPrimitives2D()

void G4OpenGLStoredSceneHandler::EndPrimitives2D ( )
virtual

Reimplemented from G4OpenGLSceneHandler.

Definition at line 181 of file G4OpenGLStoredSceneHandler.cc.

182{
183 // See all primitives immediately... At least soon...
184 ScaledFlush();
185 glDrawBuffer (GL_BACK);
187}

◆ ExtraPOProcessing()

virtual G4bool G4OpenGLStoredSceneHandler::ExtraPOProcessing ( const G4Visible & ,
size_t  )
inlineprotectedvirtual

Reimplemented in G4OpenGLStoredQtSceneHandler.

Definition at line 82 of file G4OpenGLStoredSceneHandler.hh.

83{return true;}

◆ ExtraTOProcessing()

virtual G4bool G4OpenGLStoredSceneHandler::ExtraTOProcessing ( const G4Visible & ,
size_t  )
inlineprotectedvirtual

Reimplemented in G4OpenGLStoredQtSceneHandler.

Definition at line 84 of file G4OpenGLStoredSceneHandler.hh.

85{return true;}

Friends And Related Symbol Documentation

◆ G4OpenGLStoredViewer

friend class G4OpenGLStoredViewer
friend

Definition at line 45 of file G4OpenGLStoredSceneHandler.hh.

Member Data Documentation

◆ fDisplayListId

G4int G4OpenGLStoredSceneHandler::fDisplayListId = 0
staticprotected

◆ fDoNotUseDisplayList

G4bool G4OpenGLStoredSceneHandler::fDoNotUseDisplayList
protected

◆ fPOList

std::vector<PO> G4OpenGLStoredSceneHandler::fPOList
protected

◆ fSceneIdCount

G4int G4OpenGLStoredSceneHandler::fSceneIdCount = 0
staticprotected

Definition at line 87 of file G4OpenGLStoredSceneHandler.hh.

◆ fSolidMap

std::map<const G4VSolid*, G4int, std::less <const G4VSolid*> > G4OpenGLStoredSceneHandler::fSolidMap
protected

Definition at line 148 of file G4OpenGLStoredSceneHandler.hh.

Referenced by ClearStore().

◆ fTOList

std::vector<TO> G4OpenGLStoredSceneHandler::fTOList
protected

◆ fTopPODL

GLint G4OpenGLStoredSceneHandler::fTopPODL
protected

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