87 if (&rhs ==
this)
return *
this;
135 if (&rhs ==
this)
return *
this;
170 glDrawBuffer (GL_BACK);
185 glDrawBuffer (GL_BACK);
191 return AddPrimitivePreambleInternal(visible,
true,
false);
195 return AddPrimitivePreambleInternal(visible,
false,
true);
199 return AddPrimitivePreambleInternal(visible,
false,
false);
202G4bool G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal
203(
const G4Visible& visible,
bool isMarker,
bool isPolyline)
210 G4bool transparency_enabled =
true;
211 G4bool isMarkerNotHidden =
true;
218 G4bool isTransparent = opacity < 1.;
219 G4bool isMarkerOrPolyline = isMarker || isPolyline;
220 G4bool treatAsTransparent = transparency_enabled && isTransparent;
221 G4bool treatAsNotHidden = isMarkerNotHidden && isMarkerOrPolyline;
225 if (isMarkerOrPolyline && isMarkerNotHidden)
226 glDisable (GL_DEPTH_TEST);
227 else {glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LEQUAL);}
237 if (treatAsTransparent) {
240 if (treatAsNotHidden) {
244 if (treatAsTransparent || treatAsNotHidden) {
251 if (!treatAsTransparent) {
258 if (!treatAsNotHidden) {
266 if (
fpViewer->GetViewParameters().IsPicking()) {
269 G4AttHolder* holder =
new G4AttHolder;
282 glMultMatrixd (oglt.GetGLMatrix ());
283 if (transparency_enabled) {
292 if (glGetError() == GL_OUT_OF_MEMORY) {
293 static G4int errorCount = 0;
294 if (errorCount < 5) {
298 "Error attempting to create an OpenGL display list."
300 "\nMaybe out of memory?";
302 (
"G4OpenGLStoredSceneHandler::AddPrimitivePreambleInternal",
"opengl1001",
313 to.fMarkerOrPolyline = isMarkerOrPolyline;
322 glMultMatrixd (oglt.GetGLMatrix ());
323 if (transparency_enabled) {
337 po.fMarkerOrPolyline = isMarkerOrPolyline;
344 if (transparency_enabled) {
359 if (!usesGLCommands)
return false;
367 glMatrixMode (GL_PROJECTION);
373 glMatrixMode (GL_MODELVIEW);
377 glMultMatrixd (oglt.GetGLMatrix ());
378 glDisable (GL_LIGHTING);
381 glDisable (GL_LIGHTING);
383 glEnable (GL_LIGHTING);
394 glMatrixMode (GL_PROJECTION);
396 glMatrixMode (GL_MODELVIEW);
401 if (glGetError() == GL_OUT_OF_MEMORY) {
403 "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure"
404 " to allocate display List for fTopPODL - try OpenGL Immediated mode."
409 if (glGetError() == GL_OUT_OF_MEMORY) {
411 "ERROR: G4OpenGLStoredSceneHandler::AddPrimitivePostamble: Failure"
412 " to allocate display List for fTopPODL - try OpenGL Immediated mode."
424 if (furtherprocessing) {
433 if (furtherprocessing) {
445 if (furtherprocessing) {
454 if (furtherprocessing) {
463 if (furtherprocessing) {
475 if (furtherprocessing) {
492 if (glGetError() == GL_OUT_OF_MEMORY) {
494 "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
495 " display List for fTopPODL - try OpenGL Immediated mode."
500 for (
size_t i = 0; i <
fPOList.size (); i++) {
504 if (
fpViewer->GetViewParameters().IsPicking())
512 if (glGetError() == GL_OUT_OF_MEMORY) {
514 "ERROR: G4OpenGLStoredSceneHandler::EndModeling: Failure to allocate"
515 " display List for fTopPODL - try OpenGL Immediated mode."
530 for (
size_t i = 0; i <
fPOList.size (); i++)
541 for (
size_t i = 0; i <
fTOList.size (); i++)
551 for (
size_t i = 0; i <
fTOList.size (); i++)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
G4GLOB_DLL std::ostream G4cerr
G4double GetAlpha() const
G4double GetGreen() const
virtual void EndPrimitives()
G4bool fThirdPassForNonHiddenMarkersRequested
void ClearAndDestroyAtts()
virtual void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool fThirdPassForNonHiddenMarkers
void AddPrimitive(const G4Polyline &)
virtual void EndPrimitives2D()
virtual void BeginPrimitives(const G4Transform3D &objectTransformation)
G4bool fSecondPassForTransparency
G4OpenGLSceneHandler(G4VGraphicsSystem &system, G4int id, const G4String &name="")
std::map< GLuint, G4AttHolder * > fPickMap
G4bool fSecondPassForTransparencyRequested
virtual G4bool ExtraPOProcessing(const G4Visible &, size_t)
static G4int fSceneIdCount
virtual ~G4OpenGLStoredSceneHandler()
std::map< const G4VSolid *, G4int, std::less< const G4VSolid * > > fSolidMap
std::vector< PO > fPOList
void AddPrimitive(const G4Polyline &)
G4bool AddPrimitivePreamble(const G4VMarker &visible)
G4OpenGLStoredSceneHandler(G4VGraphicsSystem &system, const G4String &name="")
virtual G4bool ExtraTOProcessing(const G4Visible &, size_t)
void BeginPrimitives(const G4Transform3D &objectTransformation)
G4bool fDoNotUseDisplayList
static G4int fDisplayListId
void ClearTransientStore()
std::vector< TO > fTOList
void AddPrimitivePostamble()
void BeginPrimitives2D(const G4Transform3D &objectTransformation)
G4bool transparency_enabled
void g4GlOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near, GLdouble far)
virtual void BeginModeling()
void LoadAtts(const G4Visible &, G4AttHolder *)
const G4Colour & GetColour()
G4Transform3D fObjectTransformation
virtual void EndModeling()
const G4VisAttributes * fpVisAttribs
G4bool fReadyForTransients
virtual void ClearStore()
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const
G4bool IsMarkerNotHidden() const
const G4VisAttributes * GetVisAttributes() const
G4TextPlus * fpG4TextPlus
G4TextPlus * fpG4TextPlus