0030470: Modeling Algorithms - Invalid result of offset operation in mode "Complete...
[occt.git] / src / OpenGl / OpenGl_Workspace.cxx
CommitLineData
b311480e 1// Created on: 2011-09-20
2// Created by: Sergey ZERCHANINOV
973c2be1 3// Copyright (c) 2011-2014 OPEN CASCADE SAS
b311480e 4//
973c2be1 5// This file is part of Open CASCADE Technology software library.
b311480e 6//
d5f74e42 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
973c2be1 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.
b311480e 12//
973c2be1 13// Alternatively, this file may be used under the terms of Open CASCADE
14// commercial license or contractual agreement.
b311480e 15
c357e426 16#include <OpenGl_Workspace.hxx>
5f8b738e 17
c357e426 18#include <OpenGl_ArbFBO.hxx>
2166f0fa
SK
19#include <OpenGl_AspectLine.hxx>
20#include <OpenGl_AspectFace.hxx>
21#include <OpenGl_AspectMarker.hxx>
22#include <OpenGl_AspectText.hxx>
bf75be98 23#include <OpenGl_Context.hxx>
679ecdee 24#include <OpenGl_Element.hxx>
a174a3c5 25#include <OpenGl_FrameBuffer.hxx>
c357e426 26#include <OpenGl_GlCore15.hxx>
27#include <OpenGl_SceneGeometry.hxx>
679ecdee 28#include <OpenGl_Structure.hxx>
25ef750e 29#include <OpenGl_Sampler.hxx>
8613985b 30#include <OpenGl_ShaderManager.hxx>
bf75be98 31#include <OpenGl_Texture.hxx>
e276548b 32#include <OpenGl_View.hxx>
c357e426 33#include <OpenGl_Window.hxx>
2166f0fa 34
bf75be98 35#include <Graphic3d_TextureParams.hxx>
825aa485 36#include <Graphic3d_TransformUtils.hxx>
f9f740d6 37#include <NCollection_AlignedAllocator.hxx>
2166f0fa 38
92efcf78 39IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Workspace,Standard_Transient)
92efcf78 40
2166f0fa
SK
41namespace
42{
b6472664 43 static const OpenGl_Vec4 THE_WHITE_COLOR (1.0f, 1.0f, 1.0f, 1.0f);
44 static const OpenGl_Vec4 THE_BLACK_COLOR (0.0f, 0.0f, 0.0f, 1.0f);
2166f0fa 45
2166f0fa
SK
46 static const OpenGl_Matrix myDefaultMatrix =
47 {
48 {{ 1.0F, 0.0F, 0.0F, 0.0F },
49 { 0.0F, 1.0F, 0.0F, 0.0F },
50 { 0.0F, 0.0F, 1.0F, 0.0F },
51 { 0.0F, 0.0F, 0.0F, 1.0F }}
52 };
bf75be98 53
a3f6f591 54}
2166f0fa
SK
55
56// =======================================================================
0adbd30f 57// function : Init
58// purpose :
59// =======================================================================
b6472664 60void OpenGl_Material::Init (const Graphic3d_MaterialAspect& theMat,
61 const Quantity_Color& theInteriorColor)
0adbd30f 62{
4e1bc39a 63 const bool isPhysic = theMat.MaterialType (Graphic3d_MATERIAL_PHYSIC);
a71a71de 64 ChangeShine() = 128.0f * theMat.Shininess();
65 ChangeTransparency() = theMat.Alpha();
b6472664 66
0adbd30f 67 // ambient component
b6472664 68 if (theMat.ReflectionMode (Graphic3d_TOR_AMBIENT))
0adbd30f 69 {
b6472664 70 const OpenGl_Vec3& aSrcAmb = isPhysic ? theMat.AmbientColor() : theInteriorColor;
4e1bc39a 71 Ambient = OpenGl_Vec4 (aSrcAmb * theMat.Ambient(), 1.0f);
0adbd30f 72 }
73 else
74 {
75 Ambient = THE_BLACK_COLOR;
76 }
77
78 // diffusion component
b6472664 79 if (theMat.ReflectionMode (Graphic3d_TOR_DIFFUSE))
0adbd30f 80 {
b6472664 81 const OpenGl_Vec3& aSrcDif = isPhysic ? theMat.DiffuseColor() : theInteriorColor;
4e1bc39a 82 Diffuse = OpenGl_Vec4 (aSrcDif * theMat.Diffuse(), 1.0f);
0adbd30f 83 }
84 else
85 {
86 Diffuse = THE_BLACK_COLOR;
87 }
88
89 // specular component
b6472664 90 if (theMat.ReflectionMode (Graphic3d_TOR_SPECULAR))
0adbd30f 91 {
b6472664 92 const OpenGl_Vec3& aSrcSpe = isPhysic ? (const OpenGl_Vec3& )theMat.SpecularColor() : THE_WHITE_COLOR.rgb();
4e1bc39a 93 Specular = OpenGl_Vec4 (aSrcSpe * theMat.Specular(), 1.0f);
0adbd30f 94 }
95 else
96 {
97 Specular = THE_BLACK_COLOR;
98 }
99
100 // emission component
b6472664 101 if (theMat.ReflectionMode (Graphic3d_TOR_EMISSION))
0adbd30f 102 {
b6472664 103 const OpenGl_Vec3& aSrcEms = isPhysic ? theMat.EmissiveColor() : theInteriorColor;
4e1bc39a 104 Emission = OpenGl_Vec4 (aSrcEms * theMat.Emissive(), 1.0f);
0adbd30f 105 }
106 else
107 {
108 Emission = THE_BLACK_COLOR;
109 }
0adbd30f 110}
111
112// =======================================================================
2166f0fa
SK
113// function : OpenGl_Workspace
114// purpose :
115// =======================================================================
c357e426 116OpenGl_Workspace::OpenGl_Workspace (OpenGl_View* theView, const Handle(OpenGl_Window)& theWindow)
1a0dfc1b 117: myView (theView),
c357e426 118 myWindow (theWindow),
119 myGlContext (!theWindow.IsNull() ? theWindow->GetGlContext() : NULL),
eae454e3 120 myUseZBuffer (Standard_True),
121 myUseDepthWrite (Standard_True),
2166f0fa 122 //
1b661a81 123 myNbSkippedTranspElems (0),
124 myRenderFilter (OpenGl_RenderFilter_Empty),
125 //
f9ba5c4d 126 myAspectLineSet (&myDefaultAspectLine),
127 myAspectFaceSet (&myDefaultAspectFace),
f9ba5c4d 128 myAspectMarkerSet (&myDefaultAspectMarker),
f9ba5c4d 129 myAspectTextSet (&myDefaultAspectText),
f9ba5c4d 130 //
2166f0fa
SK
131 ViewMatrix_applied (&myDefaultMatrix),
132 StructureMatrix_applied (&myDefaultMatrix),
b6472664 133 myToAllowFaceCulling (false),
b6472664 134 myModelViewMatrix (myDefaultMatrix)
2166f0fa 135{
c357e426 136 if (!myGlContext.IsNull() && myGlContext->MakeCurrent())
73192b37 137 {
c357e426 138 myGlContext->core11fwd->glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
2166f0fa 139
c357e426 140 // General initialization of the context
c357e426 141 #if !defined(GL_ES_VERSION_2_0)
142 if (myGlContext->core11 != NULL)
143 {
dd1ae9df 144 // enable two-side lighting by default
c357e426 145 glLightModeli ((GLenum )GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE);
dd1ae9df 146 glHint (GL_POINT_SMOOTH_HINT, GL_FASTEST);
147 if (myGlContext->caps->ffpEnable)
148 {
149 glHint (GL_FOG_HINT, GL_FASTEST);
150 }
c357e426 151 }
2166f0fa 152
c357e426 153 glHint (GL_LINE_SMOOTH_HINT, GL_FASTEST);
154 glHint (GL_POLYGON_SMOOTH_HINT, GL_FASTEST);
155 #endif
73192b37 156 }
f8ae3605 157
2a332745 158 myFontFaceAspect.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Blend, 0.285f);
c40eb6b9 159 myFontFaceAspect.Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
160
b6472664 161 myNoneCulling .Aspect()->SetSuppressBackFaces (false);
162 myNoneCulling .Aspect()->SetDrawEdges (false);
c40eb6b9 163 myNoneCulling .Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
164
b6472664 165 myFrontCulling.Aspect()->SetSuppressBackFaces (true);
166 myFrontCulling.Aspect()->SetDrawEdges (false);
c40eb6b9 167 myFrontCulling.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Opaque);
2166f0fa
SK
168}
169
170// =======================================================================
2166f0fa
SK
171// function : Activate
172// purpose :
173// =======================================================================
174Standard_Boolean OpenGl_Workspace::Activate()
175{
c357e426 176 if (myWindow.IsNull() || !myWindow->Activate())
177 {
2166f0fa 178 return Standard_False;
c357e426 179 }
2166f0fa 180
2166f0fa
SK
181 ViewMatrix_applied = &myDefaultMatrix;
182 StructureMatrix_applied = &myDefaultMatrix;
26395493 183
184 ResetAppliedAspect();
185
8613985b 186 // reset state for safety
187 myGlContext->BindProgram (Handle(OpenGl_ShaderProgram)());
188 if (myGlContext->core20fwd != NULL)
189 {
190 myGlContext->core20fwd->glUseProgram (OpenGl_ShaderProgram::NO_PROGRAM);
191 }
dd1ae9df 192 if (myGlContext->caps->ffpEnable)
193 {
194 myGlContext->ShaderManager()->PushState (Handle(OpenGl_ShaderProgram)());
195 }
2a332745 196
197#if !defined(GL_ES_VERSION_2_0)
198 // font GLSL program has embedded discard, while FFP needs alpha test
199 myFontFaceAspect.Aspect()->SetAlphaMode ((!myGlContext->caps->ffpEnable && myGlContext->core11 != NULL)
200 ? Graphic3d_AlphaMode_Blend
201 : Graphic3d_AlphaMode_Mask,
202 0.285f);
203#endif
26395493 204 return Standard_True;
2166f0fa
SK
205}
206
26395493 207//=======================================================================
208//function : ResetAppliedAspect
209//purpose : Sets default values of GL parameters in accordance with default aspects
210//=======================================================================
211void OpenGl_Workspace::ResetAppliedAspect()
212{
4e1523ef 213 myGlContext->BindDefaultVao();
214
f838dac4 215 myHighlightStyle.Nullify();
b6472664 216 myToAllowFaceCulling = false;
f9ba5c4d 217 myAspectLineSet = &myDefaultAspectLine;
218 myAspectFaceSet = &myDefaultAspectFace;
b6472664 219 myAspectFaceApplied.Nullify();
f9ba5c4d 220 myAspectMarkerSet = &myDefaultAspectMarker;
b6472664 221 myAspectMarkerApplied.Nullify();
f9ba5c4d 222 myAspectTextSet = &myDefaultAspectText;
8d1a539c 223 myGlContext->SetPolygonOffset (Graphic3d_PolygonOffset());
26395493 224
f9ba5c4d 225 ApplyAspectLine();
226 ApplyAspectFace();
227 ApplyAspectMarker();
228 ApplyAspectText();
ac116c22 229
b6472664 230 myGlContext->SetTypeOfLine (myDefaultAspectLine.Aspect()->Type());
231 myGlContext->SetLineWidth (myDefaultAspectLine.Aspect()->Width());
26395493 232}
bf75be98 233
234// =======================================================================
a6df1715 235// function : SetDefaultPolygonOffset
236// purpose :
237// =======================================================================
238Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset (const Graphic3d_PolygonOffset& theOffset)
239{
240 Graphic3d_PolygonOffset aPrev = myDefaultAspectFace.Aspect()->PolygonOffset();
241 myDefaultAspectFace.Aspect()->SetPolygonOffset (theOffset);
242 if (myAspectFaceApplied == myDefaultAspectFace.Aspect()
243 || myAspectFaceApplied.IsNull()
244 || (myAspectFaceApplied->PolygonOffset().Mode & Aspect_POM_None) == Aspect_POM_None)
245 {
246 myGlContext->SetPolygonOffset (theOffset);
247 }
248 return aPrev;
249}
250
251// =======================================================================
c357e426 252// function : SetAspectLine
38a0206f 253// purpose :
254// =======================================================================
f9ba5c4d 255const OpenGl_AspectLine* OpenGl_Workspace::SetAspectLine (const OpenGl_AspectLine* theAspect)
38a0206f 256{
f9ba5c4d 257 const OpenGl_AspectLine* aPrevAspectLine = myAspectLineSet;
258 myAspectLineSet = theAspect;
259 return aPrevAspectLine;
c357e426 260}
38a0206f 261
c357e426 262// =======================================================================
263// function : SetAspectFace
264// purpose :
265// =======================================================================
f9ba5c4d 266const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace (const OpenGl_AspectFace* theAspect)
c357e426 267{
f9ba5c4d 268 const OpenGl_AspectFace* aPrevAspectFace = myAspectFaceSet;
269 myAspectFaceSet = theAspect;
270 return aPrevAspectFace;
c357e426 271}
38a0206f 272
c357e426 273// =======================================================================
274// function : SetAspectMarker
275// purpose :
276// =======================================================================
f9ba5c4d 277const OpenGl_AspectMarker* OpenGl_Workspace::SetAspectMarker (const OpenGl_AspectMarker* theAspect)
c357e426 278{
f9ba5c4d 279 const OpenGl_AspectMarker* aPrevAspectMarker = myAspectMarkerSet;
280 myAspectMarkerSet = theAspect;
281 return aPrevAspectMarker;
c357e426 282}
f978241f 283
c357e426 284// =======================================================================
285// function : SetAspectText
286// purpose :
287// =======================================================================
f9ba5c4d 288const OpenGl_AspectText * OpenGl_Workspace::SetAspectText (const OpenGl_AspectText* theAspect)
c357e426 289{
f9ba5c4d 290 const OpenGl_AspectText* aPrevAspectText = myAspectTextSet;
291 myAspectTextSet = theAspect;
292 return aPrevAspectText;
c357e426 293}
38a0206f 294
c357e426 295// =======================================================================
f9ba5c4d 296// function : ApplyAspectFace
c357e426 297// purpose :
298// =======================================================================
f9ba5c4d 299const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
c357e426 300{
c357e426 301 if (myView->BackfacingModel() == Graphic3d_TOBM_AUTOMATIC)
38a0206f 302 {
b6472664 303 bool toSuppressBackFaces = myToAllowFaceCulling
304 && myAspectFaceSet->Aspect()->ToSuppressBackFaces();
305 if (toSuppressBackFaces)
f978241f 306 {
25c35042 307 if (myAspectFaceSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
308 || myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
c40eb6b9 309 || myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
310 || (myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_BlendAuto
311 && myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
c357e426 312 {
b6472664 313 // disable culling in case of translucent shading aspect
314 toSuppressBackFaces = false;
f978241f 315 }
f978241f 316 }
b6472664 317 myGlContext->SetCullBackFaces (toSuppressBackFaces);
f978241f 318 }
319
b6472664 320 if (myAspectFaceSet->Aspect() == myAspectFaceApplied
8613985b 321 && myHighlightStyle == myAspectFaceAppliedWithHL)
a2e4f780 322 {
f9ba5c4d 323 return myAspectFaceSet;
a2e4f780 324 }
8613985b 325 myAspectFaceAppliedWithHL = myHighlightStyle;
a2e4f780 326
2a332745 327 // Aspect_POM_None means: do not change current settings
328 if ((myAspectFaceSet->Aspect()->PolygonOffset().Mode & Aspect_POM_None) != Aspect_POM_None)
329 {
330 myGlContext->SetPolygonOffset (myAspectFaceSet->Aspect()->PolygonOffset());
331 }
332
b6472664 333 const Aspect_InteriorStyle anIntstyle = myAspectFaceSet->Aspect()->InteriorStyle();
334 if (myAspectFaceApplied.IsNull()
f9ba5c4d 335 || myAspectFaceApplied->InteriorStyle() != anIntstyle)
b86bb3df 336 {
2a332745 337 #if !defined(GL_ES_VERSION_2_0)
338 myGlContext->SetPolygonMode (anIntstyle == Aspect_IS_POINT ? GL_POINT : GL_FILL);
339 myGlContext->SetPolygonHatchEnabled (anIntstyle == Aspect_IS_HATCH);
340 #endif
91c60b57 341 }
e276548b 342
2a332745 343#if !defined(GL_ES_VERSION_2_0)
c357e426 344 if (anIntstyle == Aspect_IS_HATCH)
91c60b57 345 {
6d0e6be5 346 myGlContext->SetPolygonHatchStyle (myAspectFaceSet->Aspect()->HatchStyle());
c357e426 347 }
348#endif
38a0206f 349
8613985b 350 // Case of hidden line
2a332745 351 if (anIntstyle == Aspect_IS_HIDDENLINE)
8613985b 352 {
353 // copy all values including line edge aspect
dc89236f 354 *myAspectFaceHl.Aspect() = *myAspectFaceSet->Aspect();
8613985b 355 myAspectFaceHl.SetAspectEdge (myAspectFaceSet->AspectEdge());
dc89236f 356 myAspectFaceHl.Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
8613985b 357 myAspectFaceHl.Aspect()->SetInteriorColor (myView->BackgroundColor().GetRGB());
2a332745 358 myAspectFaceHl.Aspect()->SetDistinguish (false);
dc89236f 359 myAspectFaceHl.SetNoLighting();
8613985b 360 myAspectFaceSet = &myAspectFaceHl;
361 }
362 else
a174a3c5 363 {
a1073ae2 364 myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle);
c357e426 365 }
62e1beed 366
b6472664 367 if (myAspectFaceSet->Aspect()->ToMapTexture())
c357e426 368 {
cc8cbabe 369 myGlContext->BindTextures (myAspectFaceSet->TextureSet (myGlContext));
83da37b1 370 }
371 else
372 {
cc8cbabe 373 myGlContext->BindTextures (myEnvironmentTexture);
a174a3c5 374 }
375
b6472664 376 myAspectFaceApplied = myAspectFaceSet->Aspect();
f9ba5c4d 377 return myAspectFaceSet;
c357e426 378}
a174a3c5 379
c357e426 380// =======================================================================
f9ba5c4d 381// function : ApplyAspectMarker
c357e426 382// purpose :
383// =======================================================================
f9ba5c4d 384const OpenGl_AspectMarker* OpenGl_Workspace::ApplyAspectMarker()
c357e426 385{
b6472664 386 if (myAspectMarkerSet->Aspect() != myAspectMarkerApplied)
ee51a9fe 387 {
b6472664 388 if (myAspectMarkerApplied.IsNull()
389 || (myAspectMarkerSet->Aspect()->Scale() != myAspectMarkerApplied->Scale()))
ee51a9fe 390 {
c357e426 391 #if !defined(GL_ES_VERSION_2_0)
b6472664 392 glPointSize (myAspectMarkerSet->Aspect()->Scale());
c357e426 393 #endif
ee51a9fe 394 }
b6472664 395 myAspectMarkerApplied = myAspectMarkerSet->Aspect();
38a0206f 396 }
f9ba5c4d 397 return myAspectMarkerSet;
679ecdee 398}
399
400// =======================================================================
c357e426 401// function : Width
679ecdee 402// purpose :
403// =======================================================================
c357e426 404Standard_Integer OpenGl_Workspace::Width() const
679ecdee 405{
c357e426 406 return !myView->GlWindow().IsNull() ? myView->GlWindow()->Width() : 0;
407}
679ecdee 408
c357e426 409// =======================================================================
410// function : Height
411// purpose :
412// =======================================================================
413Standard_Integer OpenGl_Workspace::Height() const
414{
415 return !myView->GlWindow().IsNull() ? myView->GlWindow()->Height() : 0;
416}
679ecdee 417
c357e426 418// =======================================================================
c357e426 419// function : FBOCreate
679ecdee 420// purpose :
421// =======================================================================
b128c892 422Handle(OpenGl_FrameBuffer) OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth,
423 const Standard_Integer theHeight)
679ecdee 424{
c357e426 425 // activate OpenGL context
426 if (!Activate())
b128c892 427 return Handle(OpenGl_FrameBuffer)();
c357e426 428
429 // create the FBO
430 const Handle(OpenGl_Context)& aCtx = GetGlContext();
cc8cbabe 431 aCtx->BindTextures (Handle(OpenGl_TextureSet)());
b128c892 432 Handle(OpenGl_FrameBuffer) aFrameBuffer = new OpenGl_FrameBuffer();
3c4b62a4 433 if (!aFrameBuffer->Init (aCtx, theWidth, theHeight, GL_RGBA8, GL_DEPTH24_STENCIL8, 0))
679ecdee 434 {
c357e426 435 aFrameBuffer->Release (aCtx.operator->());
b128c892 436 return Handle(OpenGl_FrameBuffer)();
679ecdee 437 }
b128c892 438 return aFrameBuffer;
679ecdee 439}
440
441// =======================================================================
c357e426 442// function : FBORelease
679ecdee 443// purpose :
444// =======================================================================
b128c892 445void OpenGl_Workspace::FBORelease (Handle(OpenGl_FrameBuffer)& theFbo)
679ecdee 446{
c357e426 447 // activate OpenGL context
448 if (!Activate()
b128c892 449 || theFbo.IsNull())
62e1beed 450 {
62e1beed 451 return;
452 }
c357e426 453
b128c892 454 theFbo->Release (GetGlContext().operator->());
455 theFbo.Nullify();
c357e426 456}
62e1beed 457
f9f740d6 458// =======================================================================
f9f740d6 459// function : BufferDump
460// purpose :
461// =======================================================================
462Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)& theFbo,
463 Image_PixMap& theImage,
464 const Graphic3d_BufferType& theBufferType)
c357e426 465{
6cde53c4 466 return !theImage.IsEmpty()
467 && Activate()
468 && OpenGl_FrameBuffer::BufferDump (GetGlContext(), theFbo, theImage, theBufferType);
679ecdee 469}
91c60b57 470
91c60b57 471// =======================================================================
a1073ae2 472// function : ShouldRender
91c60b57 473// purpose :
474// =======================================================================
1b661a81 475bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
91c60b57 476{
1b661a81 477 // render only non-raytracable elements when RayTracing is enabled
478 if ((myRenderFilter & OpenGl_RenderFilter_NonRaytraceableOnly) != 0)
479 {
480 if (OpenGl_Raytrace::IsRaytracedElement (theElement))
481 {
482 return false;
483 }
484 }
485 else if ((myRenderFilter & OpenGl_RenderFilter_FillModeOnly) != 0)
486 {
487 if (!theElement->IsFillDrawMode())
488 {
489 return false;
490 }
491 }
492
493 // handle opaque/transparency render passes
494 if ((myRenderFilter & OpenGl_RenderFilter_OpaqueOnly) != 0)
495 {
496 if (!theElement->IsFillDrawMode())
497 {
498 return true;
499 }
500
501 if (OpenGl_Context::CheckIsTransparent (myAspectFaceSet, myHighlightStyle))
502 {
503 ++myNbSkippedTranspElems;
504 return false;
505 }
506 }
507 else if ((myRenderFilter & OpenGl_RenderFilter_TransparentOnly) != 0)
91c60b57 508 {
1b661a81 509 if (!theElement->IsFillDrawMode())
510 {
511 if (dynamic_cast<const OpenGl_AspectFace*> (theElement) == NULL)
512 {
513 return false;
514 }
515 }
516 else if (!OpenGl_Context::CheckIsTransparent (myAspectFaceSet, myHighlightStyle))
517 {
518 return false;
519 }
91c60b57 520 }
1b661a81 521 return true;
91c60b57 522}