1 // Created on: 2011-08-01
2 // Created by: Sergey ZERCHANINOV
3 // Copyright (c) 2011-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #include <OpenGl_CappingAlgo.hxx>
17 #include <OpenGl_Context.hxx>
18 #include <OpenGl_GlCore11.hxx>
19 #include <OpenGl_GraphicDriver.hxx>
20 #include <OpenGl_ShaderManager.hxx>
21 #include <OpenGl_ShaderProgram.hxx>
22 #include <OpenGl_StructureShadow.hxx>
23 #include <OpenGl_telem_util.hxx>
24 #include <OpenGl_Vec.hxx>
25 #include <OpenGl_View.hxx>
26 #include <OpenGl_Workspace.hxx>
28 #include <Graphic3d_SequenceOfHClipPlane.hxx>
30 IMPLEMENT_STANDARD_HANDLE (OpenGl_Structure, Graphic3d_CStructure)
31 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Structure, Graphic3d_CStructure)
33 //! Auxiliary class for bounding box presentation
34 class OpenGl_BndBoxPrs : public OpenGl_Element
40 OpenGl_BndBoxPrs (const Graphic3d_BndBox4f& theBndBox)
42 const float Xm = theBndBox.CornerMin().x();
43 const float Ym = theBndBox.CornerMin().y();
44 const float Zm = theBndBox.CornerMin().z();
45 const float XM = theBndBox.CornerMax().x();
46 const float YM = theBndBox.CornerMax().y();
47 const float ZM = theBndBox.CornerMax().z();
49 myVerts[0] = OpenGl_Vec3 (Xm, Ym, Zm);
50 myVerts[1] = OpenGl_Vec3 (Xm, Ym, ZM);
51 myVerts[2] = OpenGl_Vec3 (Xm, YM, ZM);
52 myVerts[3] = OpenGl_Vec3 (Xm, YM, Zm);
53 myVerts[4] = OpenGl_Vec3 (Xm, Ym, Zm);
54 myVerts[5] = OpenGl_Vec3 (XM, Ym, Zm);
55 myVerts[6] = OpenGl_Vec3 (XM, Ym, ZM);
56 myVerts[7] = OpenGl_Vec3 (XM, YM, ZM);
57 myVerts[8] = OpenGl_Vec3 (XM, YM, Zm);
58 myVerts[9] = OpenGl_Vec3 (XM, Ym, Zm);
59 myVerts[10] = OpenGl_Vec3 (XM, YM, Zm);
60 myVerts[11] = OpenGl_Vec3 (Xm, YM, Zm);
61 myVerts[12] = OpenGl_Vec3 (Xm, YM, ZM);
62 myVerts[13] = OpenGl_Vec3 (XM, YM, ZM);
63 myVerts[14] = OpenGl_Vec3 (XM, Ym, ZM);
64 myVerts[15] = OpenGl_Vec3 (Xm, Ym, ZM);
67 //! Render presentation
68 virtual void Render (const Handle(OpenGl_Workspace)& theWorkspace) const
70 #if !defined(GL_ES_VERSION_2_0)
72 const OpenGl_AspectLine* anAspectLine = theWorkspace->AspectLine (Standard_True);
73 const Handle(OpenGl_Texture) aPrevTexture = theWorkspace->DisableTexture();
75 glDisable (GL_LIGHTING);
77 // Use highlight colors
78 theWorkspace->GetGlContext()->core11->glColor3fv ((theWorkspace->NamedStatus & OPENGL_NS_HIGHLIGHT) ? theWorkspace->HighlightColor->rgb : anAspectLine->Color().rgb);
80 glEnableClientState (GL_VERTEX_ARRAY);
81 glVertexPointer (3, GL_FLOAT, 0, (GLfloat* )&myVerts);
82 glDrawArrays (GL_LINE_STRIP, 0, 16);
83 glDisableClientState (GL_VERTEX_ARRAY);
86 if (!aPrevTexture.IsNull())
88 theWorkspace->EnableTexture (aPrevTexture);
93 //! Release graphical resources
94 virtual void Release (OpenGl_Context*)
101 //! Protected destructor
102 virtual ~OpenGl_BndBoxPrs() {}
106 OpenGl_Vec3 myVerts[16]; //!< vertices array
110 DEFINE_STANDARD_ALLOC
114 /*----------------------------------------------------------------------*/
116 // =======================================================================
117 // function : OpenGl_Structure
119 // =======================================================================
120 OpenGl_Structure::OpenGl_Structure (const Handle(Graphic3d_StructureManager)& theManager)
121 : Graphic3d_CStructure (theManager),
122 myTransformation(NULL),
126 myAspectMarker(NULL),
128 myHighlightColor(NULL),
129 myIsRaytracable (Standard_False),
130 myModificationState (0),
131 myIsCulled (Standard_True),
132 myIsMirrored (Standard_False)
137 // =======================================================================
138 // function : ~OpenGl_Structure
140 // =======================================================================
141 OpenGl_Structure::~OpenGl_Structure()
143 Release (Handle(OpenGl_Context)());
144 delete myTransformation; myTransformation = NULL;
145 delete myTransPers; myTransPers = NULL;
148 // =======================================================================
149 // function : UpdateAspects
151 // =======================================================================
152 void OpenGl_Structure::UpdateAspects()
154 SetTransformPersistence (TransformPersistence);
156 if (ContextLine.IsDef)
157 SetAspectLine (ContextLine);
159 if (ContextFillArea.IsDef)
160 SetAspectFace (ContextFillArea);
162 if (ContextMarker.IsDef)
163 SetAspectMarker (ContextMarker);
165 if (ContextText.IsDef)
166 SetAspectText (ContextText);
169 // =======================================================================
170 // function : UpdateTransformation
172 // =======================================================================
173 void OpenGl_Structure::UpdateTransformation()
175 if (myTransformation == NULL)
177 myTransformation = new OpenGl_Matrix();
180 Standard_ShortReal (*aMat)[4] = Graphic3d_CStructure::Transformation;
182 Standard_ShortReal aDet =
183 aMat[0][0] * (aMat[1][1] * aMat[2][2] - aMat[2][1] * aMat[1][2]) -
184 aMat[0][1] * (aMat[1][0] * aMat[2][2] - aMat[2][0] * aMat[1][2]) +
185 aMat[0][2] * (aMat[1][0] * aMat[2][1] - aMat[2][0] * aMat[1][1]);
187 // Determinant of transform matrix less then 0 means that mirror transform applied.
188 myIsMirrored = aDet < 0.0f;
190 matcpy (myTransformation->mat, &Graphic3d_CStructure::Transformation[0][0]);
194 UpdateStateWithAncestorStructures();
198 // =======================================================================
199 // function : SetTransformPersistence
201 // =======================================================================
202 void OpenGl_Structure::SetTransformPersistence(const CALL_DEF_TRANSFORM_PERSISTENCE &ATransPers)
205 myTransPers = new TEL_TRANSFORM_PERSISTENCE;
207 myTransPers->mode = ATransPers.Flag;
208 myTransPers->pointX = ATransPers.Point.x;
209 myTransPers->pointY = ATransPers.Point.y;
210 myTransPers->pointZ = ATransPers.Point.z;
214 // =======================================================================
215 // function : SetAspectLine
217 // =======================================================================
218 void OpenGl_Structure::SetAspectLine (const CALL_DEF_CONTEXTLINE &theAspect)
222 myAspectLine = new OpenGl_AspectLine();
224 myAspectLine->SetAspect (theAspect);
227 // =======================================================================
228 // function : SetAspectFace
230 // =======================================================================
231 void OpenGl_Structure::SetAspectFace (const CALL_DEF_CONTEXTFILLAREA& theAspect)
235 myAspectFace = new OpenGl_AspectFace();
237 myAspectFace->SetAspect (theAspect);
241 UpdateStateWithAncestorStructures();
245 // =======================================================================
246 // function : SetAspectMarker
248 // =======================================================================
249 void OpenGl_Structure::SetAspectMarker (const CALL_DEF_CONTEXTMARKER& theAspect)
253 myAspectMarker = new OpenGl_AspectMarker();
255 myAspectMarker->SetAspect (theAspect);
258 // =======================================================================
259 // function : SetAspectText
261 // =======================================================================
262 void OpenGl_Structure::SetAspectText (const CALL_DEF_CONTEXTTEXT &theAspect)
266 myAspectText = new OpenGl_AspectText();
268 myAspectText->SetAspect (theAspect);
271 // =======================================================================
272 // function : clearHighlightBox
274 // =======================================================================
275 void OpenGl_Structure::clearHighlightBox (const Handle(OpenGl_Context)& theGlCtx)
277 if (!myHighlightBox.IsNull())
279 myHighlightBox->Release (theGlCtx);
280 myHighlightBox.Nullify();
284 // =======================================================================
285 // function : HighlightWithColor
287 // =======================================================================
288 void OpenGl_Structure::HighlightWithColor (const Graphic3d_Vec3& theColor,
289 const Standard_Boolean theToCreate)
291 const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
293 setHighlightColor (aContext, theColor);
295 clearHighlightColor (aContext);
298 // =======================================================================
299 // function : HighlightWithBndBox
301 // =======================================================================
302 void OpenGl_Structure::HighlightWithBndBox (const Handle(Graphic3d_Structure)& theStruct,
303 const Standard_Boolean theToCreate)
305 const Handle(OpenGl_Context)& aContext = GlDriver()->GetSharedContext();
308 clearHighlightBox (aContext);
312 if (!myHighlightBox.IsNull())
314 myHighlightBox->Release (aContext);
318 myHighlightBox = new OpenGl_Group (theStruct);
321 CALL_DEF_CONTEXTLINE& aContextLine = myHighlightBox->ChangeContextLine();
322 aContextLine.IsDef = 1;
323 aContextLine.Color = HighlightColor;
324 aContextLine.LineType = Aspect_TOL_SOLID;
325 aContextLine.Width = 1.0f;
326 myHighlightBox->UpdateAspectLine (Standard_True);
328 OpenGl_BndBoxPrs* aBndBoxPrs = new OpenGl_BndBoxPrs (myBndBox);
329 myHighlightBox->AddElement (aBndBoxPrs);
332 // =======================================================================
333 // function : setHighlightColor
335 // =======================================================================
336 void OpenGl_Structure::setHighlightColor (const Handle(OpenGl_Context)& theGlCtx,
337 const Graphic3d_Vec3& theColor)
339 clearHighlightBox (theGlCtx);
340 if (myHighlightColor == NULL)
342 myHighlightColor = new TEL_COLOUR();
345 myHighlightColor->rgb[0] = theColor.r();
346 myHighlightColor->rgb[1] = theColor.g();
347 myHighlightColor->rgb[2] = theColor.b();
348 myHighlightColor->rgb[3] = 1.F;
351 // =======================================================================
352 // function : clearHighlightColor
354 // =======================================================================
355 void OpenGl_Structure::clearHighlightColor (const Handle(OpenGl_Context)& theGlCtx)
357 clearHighlightBox(theGlCtx);
358 delete myHighlightColor;
359 myHighlightColor = NULL;
362 // =======================================================================
363 // function : OnVisibilityChanged
365 // =======================================================================
366 void OpenGl_Structure::OnVisibilityChanged()
370 UpdateStateWithAncestorStructures();
374 // =======================================================================
375 // function : RegisterAncestorStructure
377 // =======================================================================
378 void OpenGl_Structure::RegisterAncestorStructure (const OpenGl_Structure* theStructure) const
380 for (OpenGl_ListOfStructure::Iterator anIt (myAncestorStructures); anIt.More(); anIt.Next())
382 if (anIt.Value() == theStructure)
388 myAncestorStructures.Append (theStructure);
391 // =======================================================================
392 // function : UnregisterAncestorStructure
394 // =======================================================================
395 void OpenGl_Structure::UnregisterAncestorStructure (const OpenGl_Structure* theStructure) const
397 for (OpenGl_ListOfStructure::Iterator anIt (myAncestorStructures); anIt.More(); anIt.Next())
399 if (anIt.Value() == theStructure)
401 myAncestorStructures.Remove (anIt);
407 // =======================================================================
408 // function : UnregisterFromAncestorStructure
410 // =======================================================================
411 void OpenGl_Structure::UnregisterFromAncestorStructure() const
413 for (OpenGl_ListOfStructure::Iterator anIta (myAncestorStructures); anIta.More(); anIta.Next())
415 OpenGl_Structure* anAncestor = const_cast<OpenGl_Structure*> (anIta.ChangeValue());
417 for (OpenGl_ListOfStructure::Iterator anIts (anAncestor->myConnected); anIts.More(); anIts.Next())
419 if (anIts.Value() == this)
421 anAncestor->myConnected.Remove (anIts);
428 // =======================================================================
429 // function : UpdateStateWithAncestorStructures
431 // =======================================================================
432 void OpenGl_Structure::UpdateStateWithAncestorStructures() const
434 myModificationState++;
436 for (OpenGl_ListOfStructure::Iterator anIt (myAncestorStructures); anIt.More(); anIt.Next())
438 anIt.Value()->UpdateStateWithAncestorStructures();
442 // =======================================================================
443 // function : UpdateRaytracableWithAncestorStructures
445 // =======================================================================
446 void OpenGl_Structure::UpdateRaytracableWithAncestorStructures() const
448 myIsRaytracable = OpenGl_Raytrace::IsRaytracedStructure (this);
450 if (!myIsRaytracable)
452 for (OpenGl_ListOfStructure::Iterator anIt (myAncestorStructures); anIt.More(); anIt.Next())
454 anIt.Value()->UpdateRaytracableWithAncestorStructures();
459 // =======================================================================
460 // function : SetRaytracableWithAncestorStructures
462 // =======================================================================
463 void OpenGl_Structure::SetRaytracableWithAncestorStructures() const
465 myIsRaytracable = Standard_True;
467 for (OpenGl_ListOfStructure::Iterator anIt (myAncestorStructures); anIt.More(); anIt.Next())
469 if (!anIt.Value()->IsRaytracable())
471 anIt.Value()->SetRaytracableWithAncestorStructures();
476 // =======================================================================
477 // function : Connect
479 // =======================================================================
480 void OpenGl_Structure::Connect (Graphic3d_CStructure& theStructure)
482 OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
483 Disconnect (theStructure);
484 myConnected.Append (aStruct);
486 if (aStruct->IsRaytracable())
488 UpdateStateWithAncestorStructures();
489 SetRaytracableWithAncestorStructures();
492 aStruct->RegisterAncestorStructure (this);
495 // =======================================================================
496 // function : Disconnect
498 // =======================================================================
499 void OpenGl_Structure::Disconnect (Graphic3d_CStructure& theStructure)
501 OpenGl_Structure* aStruct = (OpenGl_Structure* )&theStructure;
502 for (OpenGl_ListOfStructure::Iterator anIter (myConnected); anIter.More(); anIter.Next())
504 // Check for the given structure
505 if (anIter.Value() == aStruct)
507 myConnected.Remove (anIter);
509 if (aStruct->IsRaytracable())
511 UpdateStateWithAncestorStructures();
512 UpdateRaytracableWithAncestorStructures();
515 aStruct->UnregisterAncestorStructure (this);
521 // =======================================================================
522 // function : NewGroup
524 // =======================================================================
525 Handle(Graphic3d_Group) OpenGl_Structure::NewGroup (const Handle(Graphic3d_Structure)& theStruct)
527 Handle(OpenGl_Group) aGroup = new OpenGl_Group (theStruct);
528 myGroups.Append (aGroup);
532 // =======================================================================
533 // function : RemoveGroup
535 // =======================================================================
536 void OpenGl_Structure::RemoveGroup (const Handle(Graphic3d_Group)& theGroup)
538 if (theGroup.IsNull())
543 for (Graphic3d_SequenceOfGroup::Iterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
545 // Check for the given group
546 if (aGroupIter.Value() == theGroup)
548 theGroup->Clear (Standard_False);
550 if (((OpenGl_Group* )theGroup.operator->())->IsRaytracable())
552 UpdateStateWithAncestorStructures();
553 UpdateRaytracableWithAncestorStructures();
556 myGroups.Remove (aGroupIter);
562 // =======================================================================
565 // =======================================================================
566 void OpenGl_Structure::Clear()
568 Clear (GlDriver()->GetSharedContext());
571 // =======================================================================
574 // =======================================================================
575 void OpenGl_Structure::Clear (const Handle(OpenGl_Context)& theGlCtx)
577 Standard_Boolean aRaytracableGroupDeleted (Standard_False);
580 for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
582 aRaytracableGroupDeleted |= aGroupIter.Value()->IsRaytracable();
585 aGroupIter.ChangeValue()->Release (theGlCtx);
589 if (aRaytracableGroupDeleted)
591 UpdateStateWithAncestorStructures();
592 UpdateRaytracableWithAncestorStructures();
595 Is2dText = Standard_False;
596 IsForHighlight = Standard_False;
599 // =======================================================================
600 // function : RenderGeometry
602 // =======================================================================
603 void OpenGl_Structure::RenderGeometry (const Handle(OpenGl_Workspace) &theWorkspace) const
606 const Graphic3d_SequenceOfGroup& aGroups = DrawGroups();
607 for (OpenGl_Structure::GroupIterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
609 aGroupIter.Value()->Render (theWorkspace);
613 // =======================================================================
616 // =======================================================================
617 void OpenGl_Structure::Render (const Handle(OpenGl_Workspace) &theWorkspace) const
619 // Process the structure only if visible
625 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
627 // Render named status
628 const Standard_Integer aNamedStatus = theWorkspace->NamedStatus;
631 theWorkspace->NamedStatus |= OPENGL_NS_HIGHLIGHT;
634 // Do we need to restore GL_NORMALIZE?
635 const Standard_Boolean anOldGlNormalize = aCtx->IsGlNormalizeEnabled();
637 // Apply local transformation
638 if (myTransformation)
640 OpenGl_Matrix aModelWorld;
641 OpenGl_Transposemat3 (&aModelWorld, myTransformation);
642 aCtx->ModelWorldState.Push();
643 aCtx->ModelWorldState.SetCurrent (OpenGl_Mat4::Map ((Standard_ShortReal* )aModelWorld.mat));
645 Standard_ShortReal aScaleX = OpenGl_Vec3 (myTransformation->mat[0][0],
646 myTransformation->mat[0][1],
647 myTransformation->mat[0][2]).SquareModulus();
648 // Scale transform detected.
649 if (Abs (aScaleX - 1.f) > Precision::Confusion())
651 aCtx->SetGlNormalizeEnabled (Standard_True);
655 // Apply transform persistence
656 const TEL_TRANSFORM_PERSISTENCE *aTransPersistence = NULL;
657 if ( myTransPers && myTransPers->mode != 0 )
659 aTransPersistence = theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, myTransPers, theWorkspace->Width(), theWorkspace->Height());
662 // Take into account transform persistence
663 aCtx->ApplyModelViewMatrix();
666 const OpenGl_AspectLine *anAspectLine = theWorkspace->AspectLine (Standard_False);
667 const OpenGl_AspectFace *anAspectFace = theWorkspace->AspectFace (Standard_False);
668 const OpenGl_AspectMarker *anAspectMarker = theWorkspace->AspectMarker (Standard_False);
669 const OpenGl_AspectText *anAspectText = theWorkspace->AspectText (Standard_False);
672 theWorkspace->SetAspectLine (myAspectLine);
676 theWorkspace->SetAspectFace (myAspectFace);
680 theWorkspace->SetAspectMarker (myAspectMarker);
684 theWorkspace->SetAspectText (myAspectText);
687 // Apply correction for mirror transform
690 aCtx->core11fwd->glFrontFace (GL_CW);
693 // Apply highlight color
694 const TEL_COLOUR *aHighlightColor = theWorkspace->HighlightColor;
695 if (myHighlightColor)
696 theWorkspace->HighlightColor = myHighlightColor;
698 // Render connected structures
699 OpenGl_ListOfStructure::Iterator anIter (myConnected);
700 while (anIter.More())
702 anIter.Value()->RenderGeometry (theWorkspace);
706 // Set up plane equations for non-structure transformed global model-view matrix
707 // List of planes to be applied to context state
708 NCollection_Handle<Graphic3d_SequenceOfHClipPlane> aUserPlanes;
710 // Collect clipping planes of structure scope
711 if (!myClipPlanes.IsEmpty())
713 Graphic3d_SequenceOfHClipPlane::Iterator aClippingIter (myClipPlanes);
714 for (; aClippingIter.More(); aClippingIter.Next())
716 const Handle(Graphic3d_ClipPlane)& aClipPlane = aClippingIter.Value();
717 if (!aClipPlane->IsOn())
722 if (aUserPlanes.IsNull())
724 aUserPlanes = new Graphic3d_SequenceOfHClipPlane();
727 aUserPlanes->Append (aClipPlane);
731 if (!aUserPlanes.IsNull() && !aUserPlanes->IsEmpty())
733 // add planes at loaded view matrix state
734 aCtx->ChangeClipping().AddWorld (*aUserPlanes, theWorkspace);
736 // Set OCCT state uniform variables
737 if (!aCtx->ShaderManager()->IsEmpty())
739 aCtx->ShaderManager()->UpdateClippingState();
744 const Graphic3d_SequenceOfGroup& aGroups = DrawGroups();
745 for (OpenGl_Structure::GroupIterator aGroupIter (aGroups); aGroupIter.More(); aGroupIter.Next())
747 aGroupIter.Value()->Render (theWorkspace);
750 // Reset correction for mirror transform
753 aCtx->core11fwd->glFrontFace (GL_CCW);
756 // Render capping for structure groups
757 if (!aCtx->Clipping().Planes().IsEmpty())
759 OpenGl_CappingAlgo::RenderCapping (theWorkspace, aGroups);
762 // Revert structure clippings
763 if (!aUserPlanes.IsNull() && !aUserPlanes->IsEmpty())
765 aCtx->ChangeClipping().Remove (*aUserPlanes);
767 // Set OCCT state uniform variables
768 if (!aCtx->ShaderManager()->IsEmpty())
770 aCtx->ShaderManager()->RevertClippingState();
774 // Apply local transformation
775 if (myTransformation)
777 aCtx->ModelWorldState.Pop();
778 aCtx->SetGlNormalizeEnabled (anOldGlNormalize);
781 // Restore highlight color
782 theWorkspace->HighlightColor = aHighlightColor;
785 theWorkspace->SetAspectLine (anAspectLine);
786 theWorkspace->SetAspectFace (anAspectFace);
787 theWorkspace->SetAspectMarker (anAspectMarker);
788 theWorkspace->SetAspectText (anAspectText);
790 // Restore transform persistence
791 if ( myTransPers && myTransPers->mode != 0 )
793 theWorkspace->ActiveView()->BeginTransformPersistence (aCtx, aTransPersistence, theWorkspace->Width(), theWorkspace->Height());
796 // Apply highlight box
797 if (!myHighlightBox.IsNull())
799 myHighlightBox->Render (theWorkspace);
802 // Restore named status
803 theWorkspace->NamedStatus = aNamedStatus;
806 // =======================================================================
807 // function : Release
809 // =======================================================================
810 void OpenGl_Structure::Release (const Handle(OpenGl_Context)& theGlCtx)
814 OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectLine);
815 OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectFace);
816 OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectMarker);
817 OpenGl_Element::Destroy (theGlCtx.operator->(), myAspectText);
818 clearHighlightColor (theGlCtx);
820 // Remove from connected list of ancestor
821 UnregisterFromAncestorStructure();
824 // =======================================================================
825 // function : ReleaseGlResources
827 // =======================================================================
828 void OpenGl_Structure::ReleaseGlResources (const Handle(OpenGl_Context)& theGlCtx)
830 for (OpenGl_Structure::GroupIterator aGroupIter (myGroups); aGroupIter.More(); aGroupIter.Next())
832 aGroupIter.ChangeValue()->Release (theGlCtx);
834 if (myAspectLine != NULL)
836 myAspectLine->Release (theGlCtx.operator->());
838 if (myAspectFace != NULL)
840 myAspectFace->Release (theGlCtx.operator->());
842 if (myAspectMarker != NULL)
844 myAspectMarker->Release (theGlCtx.operator->());
846 if (myAspectText != NULL)
848 myAspectText->Release (theGlCtx.operator->());
850 if (!myHighlightBox.IsNull())
852 myHighlightBox->Release (theGlCtx.operator->());
856 //=======================================================================
857 //function : ShadowLink
859 //=======================================================================
860 Handle(Graphic3d_CStructure) OpenGl_Structure::ShadowLink (const Handle(Graphic3d_StructureManager)& theManager) const
862 return new OpenGl_StructureShadow (theManager, this);