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