1 // Created on: 2012-02-02
2 // Created by: Anton POLETAEV
3 // Copyright (c) 2012-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_GlCore15.hxx>
18 #include <BVH_LinearBuilder.hxx>
19 #include <OpenGl_FrameBuffer.hxx>
20 #include <OpenGl_LayerList.hxx>
21 #include <OpenGl_ShaderManager.hxx>
22 #include <OpenGl_Structure.hxx>
23 #include <OpenGl_VertexBuffer.hxx>
24 #include <OpenGl_View.hxx>
25 #include <OpenGl_Workspace.hxx>
27 #include <Graphic3d_GraphicDriver.hxx>
29 //=======================================================================
30 //function : OpenGl_LayerList
31 //purpose : Constructor
32 //=======================================================================
34 OpenGl_LayerList::OpenGl_LayerList (const Standard_Integer theNbPriorities)
35 : myBVHBuilder (new BVH_LinearBuilder<Standard_Real, 3> (BVH_Constants_LeafNodeSizeSingle, BVH_Constants_MaxTreeDepth)),
36 myDefaultLayerIndex (0),
37 myNbPriorities (theNbPriorities),
39 myImmediateNbStructures (0),
40 myModifStateOfRaytraceable (0),
41 myRenderOpaqueFilter (new OpenGl_OpaqueFilter()),
42 myRenderTranspFilter (new OpenGl_TransparentFilter())
44 // insert default priority layers
45 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
46 myLayerIds.Bind (Graphic3d_ZLayerId_BotOSD, myLayers.Upper());
48 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
49 myLayerIds.Bind (Graphic3d_ZLayerId_Default, myLayers.Upper());
51 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
52 myLayerIds.Bind (Graphic3d_ZLayerId_Top, myLayers.Upper());
54 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
55 myLayerIds.Bind (Graphic3d_ZLayerId_Topmost, myLayers.Upper());
57 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
58 myLayerIds.Bind (Graphic3d_ZLayerId_TopOSD, myLayers.Upper());
60 myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
62 myTransparentToProcess.Allocate (myLayers.Length());
65 //=======================================================================
66 //function : ~OpenGl_LayerList
67 //purpose : Destructor
68 //=======================================================================
70 OpenGl_LayerList::~OpenGl_LayerList()
74 //=======================================================================
75 //function : SetFrustumCullingBVHBuilder
77 //=======================================================================
78 void OpenGl_LayerList::SetFrustumCullingBVHBuilder (const Handle(Select3D_BVHBuilder3d)& theBuilder)
80 myBVHBuilder = theBuilder;
81 for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next())
83 anIts.ChangeValue()->SetFrustumCullingBVHBuilder (theBuilder);
87 //=======================================================================
90 //=======================================================================
92 void OpenGl_LayerList::AddLayer (const Graphic3d_ZLayerId theLayerId)
94 if (myLayerIds.IsBound (theLayerId))
100 myLayers.Append (new OpenGl_Layer (myNbPriorities, myBVHBuilder));
101 myLayerIds.Bind (theLayerId, myLayers.Length());
103 myTransparentToProcess.Allocate (myLayers.Length());
106 //=======================================================================
109 //=======================================================================
110 OpenGl_Layer& OpenGl_LayerList::Layer (const Graphic3d_ZLayerId theLayerId)
112 return *myLayers.ChangeValue (myLayerIds.Find (theLayerId));
115 //=======================================================================
118 //=======================================================================
119 const OpenGl_Layer& OpenGl_LayerList::Layer (const Graphic3d_ZLayerId theLayerId) const
121 return *myLayers.Value (myLayerIds.Find (theLayerId));
124 //=======================================================================
125 //function : RemoveLayer
127 //=======================================================================
129 void OpenGl_LayerList::RemoveLayer (const Graphic3d_ZLayerId theLayerId)
131 if (!myLayerIds.IsBound (theLayerId)
137 const Standard_Integer aRemovePos = myLayerIds.Find (theLayerId);
139 // move all displayed structures to first layer
141 const OpenGl_Layer& aLayerToMove = *myLayers.Value (aRemovePos);
142 myLayers.ChangeFirst()->Append (aLayerToMove);
146 myLayers.Remove (aRemovePos);
147 myLayerIds.UnBind (theLayerId);
149 // updated sequence indexes in map
150 for (OpenGl_LayerSeqIds::Iterator aMapIt (myLayerIds); aMapIt.More(); aMapIt.Next())
152 Standard_Integer& aSeqIdx = aMapIt.ChangeValue();
153 if (aSeqIdx > aRemovePos)
157 myDefaultLayerIndex = myLayerIds.Find (Graphic3d_ZLayerId_Default);
159 myTransparentToProcess.Allocate (myLayers.Length());
162 //=======================================================================
163 //function : AddStructure
165 //=======================================================================
167 void OpenGl_LayerList::AddStructure (const OpenGl_Structure* theStruct,
168 const Graphic3d_ZLayerId theLayerId,
169 const Standard_Integer thePriority,
170 Standard_Boolean isForChangePriority)
172 // add structure to associated layer,
173 // if layer doesn't exists, display structure in default layer
174 Standard_Integer aSeqPos = myLayers.Lower();
175 myLayerIds.Find (theLayerId, aSeqPos);
177 OpenGl_Layer& aLayer = *myLayers.ChangeValue (aSeqPos);
178 aLayer.Add (theStruct, thePriority, isForChangePriority);
180 if (aLayer.IsImmediate())
182 ++myImmediateNbStructures;
185 // Note: In ray-tracing mode we don't modify modification
186 // state here. It is redundant, because the possible changes
187 // will be handled in the loop for structures
190 //=======================================================================
191 //function : RemoveStructure
193 //=======================================================================
195 void OpenGl_LayerList::RemoveStructure (const OpenGl_Structure* theStructure)
197 const Graphic3d_ZLayerId aLayerId = theStructure->ZLayer();
199 Standard_Integer aSeqPos = myLayers.Lower();
200 myLayerIds.Find (aLayerId, aSeqPos);
202 OpenGl_Layer& aLayer = *myLayers.ChangeValue (aSeqPos);
203 Standard_Integer aPriority = -1;
205 // remove structure from associated list
206 // if the structure is not found there,
207 // scan through layers and remove it
208 if (aLayer.Remove (theStructure, aPriority))
211 if (aLayer.IsImmediate())
213 --myImmediateNbStructures;
216 if (aLayerId == Graphic3d_ZLayerId_Default
217 && theStructure->IsRaytracable())
219 ++myModifStateOfRaytraceable;
225 // scan through layers and remove it
226 Standard_Integer aSeqId = 1;
227 for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
229 OpenGl_Layer& aLayerEx = *anIts.ChangeValue();
230 if (aSeqPos == aSeqId)
235 if (aLayerEx.Remove (theStructure, aPriority))
238 if (aLayerEx.IsImmediate())
240 --myImmediateNbStructures;
243 if (aSeqId == myDefaultLayerIndex
244 && theStructure->IsRaytracable())
246 ++myModifStateOfRaytraceable;
253 //=======================================================================
254 //function : InvalidateBVHData
256 //=======================================================================
257 void OpenGl_LayerList::InvalidateBVHData (const Graphic3d_ZLayerId theLayerId)
259 Standard_Integer aSeqPos = myLayers.Lower();
260 myLayerIds.Find (theLayerId, aSeqPos);
261 OpenGl_Layer& aLayer = *myLayers.ChangeValue (aSeqPos);
262 aLayer.InvalidateBVHData();
265 //=======================================================================
266 //function : ChangeLayer
268 //=======================================================================
270 void OpenGl_LayerList::ChangeLayer (const OpenGl_Structure* theStructure,
271 const Graphic3d_ZLayerId theOldLayerId,
272 const Graphic3d_ZLayerId theNewLayerId)
274 Standard_Integer aSeqPos = myLayers.Lower();
275 myLayerIds.Find (theOldLayerId, aSeqPos);
276 OpenGl_Layer& aLayer = *myLayers.ChangeValue (aSeqPos);
277 Standard_Integer aPriority = -1;
279 // take priority and remove structure from list found by <theOldLayerId>
280 // if the structure is not found there, scan through all other layers
281 if (aLayer.Remove (theStructure, aPriority, Standard_False))
283 if (theOldLayerId == Graphic3d_ZLayerId_Default
284 && theStructure->IsRaytracable())
286 ++myModifStateOfRaytraceable;
290 if (aLayer.IsImmediate())
292 --myImmediateNbStructures;
295 // isForChangePriority should be Standard_False below, because we want
296 // the BVH tree in the target layer to be updated with theStructure
297 AddStructure (theStructure, theNewLayerId, aPriority);
301 // scan through layers and remove it
302 Standard_Integer aSeqId = 1;
303 for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
305 if (aSeqPos == aSeqId)
310 // try to remove structure and get priority value from this layer
311 OpenGl_Layer& aLayerEx = *anIts.ChangeValue();
312 if (aLayerEx.Remove (theStructure, aPriority, Standard_True))
314 if (aSeqId == myDefaultLayerIndex
315 && theStructure->IsRaytracable())
317 ++myModifStateOfRaytraceable;
321 if (aLayerEx.IsImmediate())
323 --myImmediateNbStructures;
326 // isForChangePriority should be Standard_False below, because we want
327 // the BVH tree in the target layer to be updated with theStructure
328 AddStructure (theStructure, theNewLayerId, aPriority);
334 //=======================================================================
335 //function : ChangePriority
337 //=======================================================================
338 void OpenGl_LayerList::ChangePriority (const OpenGl_Structure* theStructure,
339 const Graphic3d_ZLayerId theLayerId,
340 const Standard_Integer theNewPriority)
342 Standard_Integer aSeqPos = myLayers.Lower();
343 myLayerIds.Find (theLayerId, aSeqPos);
344 OpenGl_Layer& aLayer = *myLayers.ChangeValue (aSeqPos);
345 Standard_Integer anOldPriority = -1;
347 if (aLayer.Remove (theStructure, anOldPriority, Standard_True))
350 if (aLayer.IsImmediate())
352 --myImmediateNbStructures;
355 AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
359 Standard_Integer aSeqId = 1;
360 for (OpenGl_SequenceOfLayers::Iterator anIts (myLayers); anIts.More(); anIts.Next(), ++aSeqId)
362 if (aSeqPos == aSeqId)
367 OpenGl_Layer& aLayerEx = *anIts.ChangeValue();
368 if (aLayerEx.Remove (theStructure, anOldPriority, Standard_True))
371 if (aLayerEx.IsImmediate())
373 --myImmediateNbStructures;
376 AddStructure (theStructure, theLayerId, theNewPriority, Standard_True);
382 //=======================================================================
383 //function : SetLayerSettings
385 //=======================================================================
386 void OpenGl_LayerList::SetLayerSettings (const Graphic3d_ZLayerId theLayerId,
387 const Graphic3d_ZLayerSettings& theSettings)
389 OpenGl_Layer& aLayer = Layer (theLayerId);
390 if (aLayer.LayerSettings().IsImmediate() != theSettings.IsImmediate())
392 if (theSettings.IsImmediate())
394 myImmediateNbStructures += aLayer.NbStructures();
398 myImmediateNbStructures -= aLayer.NbStructures();
401 aLayer.SetLayerSettings (theSettings);
404 //=======================================================================
407 //=======================================================================
408 void OpenGl_LayerList::Render (const Handle(OpenGl_Workspace)& theWorkspace,
409 const Standard_Boolean theToDrawImmediate,
410 const OpenGl_LayerFilter theLayersToProcess,
411 OpenGl_FrameBuffer* theReadDrawFbo,
412 OpenGl_FrameBuffer* theOitAccumFbo) const
414 // Remember global settings for glDepth function and write mask.
415 OpenGl_GlobalLayerSettings aDefaultSettings;
417 const Handle(OpenGl_Context)& aCtx = theWorkspace->GetGlContext();
418 aCtx->core11fwd->glGetIntegerv (GL_DEPTH_FUNC, &aDefaultSettings.DepthFunc);
419 aCtx->core11fwd->glGetBooleanv (GL_DEPTH_WRITEMASK, &aDefaultSettings.DepthMask);
421 // Two render filters are used to support transparency draw. Opaque filter accepts
422 // only non-transparent OpenGl elements of a layer and counts number of skipped
423 // transparent ones. If the counter has positive value the layer is added into
424 // transparency post-processing stack. At the end of drawing or once the depth
425 // buffer is to be cleared the layers in the stack should be drawn using
426 // blending and depth mask settings and another transparency filter which accepts
427 // only transparent OpenGl elements of a layer. The stack <myTransparentToProcess>
428 // was preallocated before going into this method and has enough space to keep
429 // maximum number of references to layers, therefore it will not increase memory
430 // fragmentation during regular rendering.
431 const Handle(OpenGl_RenderFilter) aPrevFilter = theWorkspace->GetRenderFilter();
432 myRenderOpaqueFilter->SetPreviousFilter (aPrevFilter);
433 myRenderTranspFilter->SetPreviousFilter (aPrevFilter);
434 theWorkspace->SetRenderFilter (myRenderOpaqueFilter);
436 myTransparentToProcess.Clear();
438 OpenGl_LayerStack::iterator aStackIter (myTransparentToProcess.Origin());
439 Standard_Integer aSeqId = myLayers.Lower();
440 bool toClearDepth = false;
441 for (OpenGl_SequenceOfLayers::Iterator aLayerIter (myLayers); aLayerIter.More(); aLayerIter.Next(), ++aSeqId)
443 if (theLayersToProcess == OpenGl_LF_Bottom)
445 if (aSeqId >= myDefaultLayerIndex) continue;
447 else if (theLayersToProcess == OpenGl_LF_Upper)
449 if (aSeqId <= myDefaultLayerIndex) continue;
451 else if (theLayersToProcess == OpenGl_LF_Default)
453 if (aSeqId != myDefaultLayerIndex) continue;
456 const OpenGl_Layer& aLayer = *aLayerIter.Value();
457 if (aLayer.IsImmediate() != theToDrawImmediate)
461 else if (aLayer.NbStructures() < 1)
463 // Make sure to clear depth of previous layers even if layer has no structures.
464 toClearDepth = toClearDepth || aLayer.LayerSettings().ToClearDepth();
468 // At this point the depth buffer may be set to clear by
469 // previous configuration of layers or configuration of the
470 // current layer. Additional rendering pass to handle transparent
471 // elements of recently drawn layers require use of current depth
472 // buffer so we put remaining layers for processing as one bunch before
473 // erasing the depth buffer.
475 || aLayer.LayerSettings().ToClearDepth())
477 if (!myTransparentToProcess.IsEmpty())
479 renderTransparent (theWorkspace, aStackIter, aDefaultSettings, theReadDrawFbo, theOitAccumFbo);
482 toClearDepth = false;
483 glDepthMask (GL_TRUE);
484 glClear (GL_DEPTH_BUFFER_BIT);
487 // Render opaque OpenGl elements of a layer and count the number of skipped.
488 // If a layer has skipped (e.g. transparent) elements it should be added into
489 // the transparency post-processing stack.
490 myRenderOpaqueFilter->SetSkippedCounter (0);
492 aLayer.Render (theWorkspace, aDefaultSettings);
494 if (myRenderOpaqueFilter->NbSkipped() > 0)
496 myTransparentToProcess.Push (&aLayer);
500 // Before finishing process the remaining collected layers with transparency.
501 if (!myTransparentToProcess.IsEmpty())
503 renderTransparent (theWorkspace, aStackIter, aDefaultSettings, theReadDrawFbo, theOitAccumFbo);
508 glDepthMask (GL_TRUE);
509 glClear (GL_DEPTH_BUFFER_BIT);
512 aCtx->core11fwd->glDepthMask (aDefaultSettings.DepthMask);
513 aCtx->core11fwd->glDepthFunc (aDefaultSettings.DepthFunc);
515 theWorkspace->SetRenderFilter (aPrevFilter);
518 //=======================================================================
519 //function : renderTransparent
520 //purpose : Render transparent objects using blending operator.
521 //=======================================================================
522 void OpenGl_LayerList::renderTransparent (const Handle(OpenGl_Workspace)& theWorkspace,
523 OpenGl_LayerStack::iterator& theLayerIter,
524 const OpenGl_GlobalLayerSettings& theGlobalSettings,
525 OpenGl_FrameBuffer* theReadDrawFbo,
526 OpenGl_FrameBuffer* theOitAccumFbo) const
528 // Blended order-independent transparency algorithm require several preconditions
529 // to be enabled. It should be requested by user, at least two outputs from
530 // fragment shader should be supported by GPU, so is the given framebuffer
531 // should contain two additional color buffers to handle accumulated color channels,
532 // blended alpha channel and weight factors - these accumulation buffers are required
533 // to implement commuting blend operator (at least OpenGl 2.0 should be available).
534 const bool isEnabledOit = theOitAccumFbo != NULL
535 && theOitAccumFbo->NbColorBuffers() >= 2
536 && theOitAccumFbo->ColorTexture (0)->IsValid()
537 && theOitAccumFbo->ColorTexture (1)->IsValid();
539 // Check if current iterator has already reached the end of the stack.
540 // This should happen if no additional layers has been added to
541 // the processing stack after last transparency pass.
542 if (theLayerIter == myTransparentToProcess.Back())
547 const Handle(OpenGl_Context) aCtx = theWorkspace->GetGlContext();
548 const Handle(OpenGl_ShaderManager)& aManager = aCtx->ShaderManager();
549 OpenGl_View* aView = theWorkspace->View();
550 const float aDepthFactor = aView != NULL ? aView->RenderingParams().OitDepthFactor : 0.0f;
552 theWorkspace->SetRenderFilter (myRenderTranspFilter);
554 aCtx->core11fwd->glEnable (GL_BLEND);
558 aManager->SetOitState (true, aDepthFactor);
560 theOitAccumFbo->BindBuffer (aCtx);
562 static const Standard_Integer aDrawBuffers[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT0 + 1 };
563 aCtx->SetDrawBuffers (2, aDrawBuffers);
564 aCtx->core11fwd->glClearColor (0.0f, 0.0f, 0.0f, 1.0f);
565 aCtx->core11fwd->glClear (GL_COLOR_BUFFER_BIT);
566 aCtx->core15fwd->glBlendFuncSeparate (GL_ONE, GL_ONE, GL_ZERO, GL_ONE_MINUS_SRC_ALPHA);
570 aCtx->core11fwd->glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
573 // During blended order-independent transparency pass the depth test
574 // should be enabled to discard fragments covered by opaque geometry
575 // and depth writing should be disabled, because transparent fragments
576 // overal each other with non unitary coverage factor.
577 OpenGl_GlobalLayerSettings aGlobalSettings = theGlobalSettings;
578 aGlobalSettings.DepthMask = GL_FALSE;
579 aCtx->core11fwd->glDepthMask (GL_FALSE);
581 for (; theLayerIter != myTransparentToProcess.Back(); ++theLayerIter)
583 (*theLayerIter)->Render (theWorkspace, aGlobalSettings);
586 // Revert state of rendering.
589 aManager->SetOitState (false, aDepthFactor);
590 theOitAccumFbo->UnbindBuffer (aCtx);
593 theReadDrawFbo->BindBuffer (aCtx);
596 static const Standard_Integer aDrawBuffers[] = { GL_COLOR_ATTACHMENT0 };
597 aCtx->SetDrawBuffers (1, aDrawBuffers);
600 theWorkspace->SetRenderFilter (myRenderOpaqueFilter);
603 const Standard_Boolean isMSAA = theReadDrawFbo && theReadDrawFbo->NbSamples() > 0;
604 OpenGl_VertexBuffer* aVerts = theWorkspace->View()->initBlitQuad (Standard_False);
605 if (aVerts->IsValid() && aManager->BindOitCompositingProgram (isMSAA))
607 aCtx->core11fwd->glDepthFunc (GL_ALWAYS);
608 aCtx->core11fwd->glDepthMask (GL_FALSE);
610 // Bind full screen quad buffer and framebuffer resources.
611 aVerts->BindVertexAttrib (aCtx, Graphic3d_TOA_POS);
613 const Handle(OpenGl_Texture) aTextureBack = theWorkspace->DisableTexture();
615 theOitAccumFbo->ColorTexture (0)->Bind (aCtx, GL_TEXTURE0 + 0);
616 theOitAccumFbo->ColorTexture (1)->Bind (aCtx, GL_TEXTURE0 + 1);
618 // Draw full screen quad with special shader to compose the buffers.
619 aCtx->core11fwd->glBlendFunc (GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA);
620 aCtx->core11fwd->glDrawArrays (GL_TRIANGLE_STRIP, 0, 4);
622 // Unbind OpenGL texture objects and shader program.
623 aVerts->UnbindVertexAttrib (aCtx, Graphic3d_TOA_POS);
624 theOitAccumFbo->ColorTexture (0)->Unbind (aCtx, GL_TEXTURE0 + 0);
625 theOitAccumFbo->ColorTexture (1)->Unbind (aCtx, GL_TEXTURE0 + 1);
626 aCtx->BindProgram (NULL);
628 if (!aTextureBack.IsNull())
630 theWorkspace->EnableTexture (aTextureBack);
635 aCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
636 "Initialization of OIT compositing pass has failed.\n"
637 " Blended order-independent transparency will not be available.\n");
640 Standard_Boolean& aOITFlag = isMSAA ? aView->myToDisableOITMSAA : aView->myToDisableOIT;
641 aOITFlag = Standard_True;
646 aCtx->core11fwd->glDisable (GL_BLEND);
647 aCtx->core11fwd->glBlendFunc (GL_ONE, GL_ZERO);
648 aCtx->core11fwd->glDepthMask (theGlobalSettings.DepthMask);
649 aCtx->core11fwd->glDepthFunc (theGlobalSettings.DepthFunc);
652 //=======================================================================
653 //class : OpenGl_OpaqueFilter
654 //function : ShouldRender
655 //purpose : Checks whether the element should be rendered or skipped.
656 //=======================================================================
657 Standard_Boolean OpenGl_LayerList::OpenGl_OpaqueFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
658 const OpenGl_Element* theGlElement)
660 if (!myFilter.IsNull()
661 && !myFilter->ShouldRender (theWorkspace, theGlElement))
663 return Standard_False;
666 const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theGlElement);
668 || aPArray->DrawMode() < OpenGl_PrimitiveArray::THE_FILLPRIM_FROM
669 || aPArray->DrawMode() > OpenGl_PrimitiveArray::THE_FILLPRIM_TO)
671 return Standard_True;
674 if (OpenGl_Context::CheckIsTransparent (theWorkspace->AspectFace(),
675 theWorkspace->HighlightStyle()))
678 return Standard_False;
681 return Standard_True;
684 //=======================================================================
685 //class : OpenGl_TransparentFilter
686 //function : ShouldRender
687 //purpose : Checks whether the element should be rendered or skipped.
688 //=======================================================================
689 Standard_Boolean OpenGl_LayerList::OpenGl_TransparentFilter::ShouldRender (const Handle(OpenGl_Workspace)& theWorkspace,
690 const OpenGl_Element* theGlElement)
692 if (!myFilter.IsNull()
693 && !myFilter->ShouldRender (theWorkspace, theGlElement))
695 return Standard_False;
698 const OpenGl_PrimitiveArray* aPArray = dynamic_cast<const OpenGl_PrimitiveArray*> (theGlElement);
700 || aPArray->DrawMode() < OpenGl_PrimitiveArray::THE_FILLPRIM_FROM
701 || aPArray->DrawMode() > OpenGl_PrimitiveArray::THE_FILLPRIM_TO)
703 return dynamic_cast<const OpenGl_AspectFace*> (theGlElement) != NULL;
706 return OpenGl_Context::CheckIsTransparent (theWorkspace->AspectFace(),
707 theWorkspace->HighlightStyle());