0030483: Visualization, Path Tracing - make Tile Size configurable
[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 55
0adbd30f 56// =======================================================================
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
2166f0fa
SK
112// =======================================================================
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
c40eb6b9 158 myFontFaceAspect.Aspect()->SetAlphaMode (Graphic3d_AlphaMode_Mask, 0.285f);
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
2166f0fa
SK
170// =======================================================================
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 }
26395493 196 return Standard_True;
2166f0fa
SK
197}
198
26395493 199//=======================================================================
200//function : ResetAppliedAspect
201//purpose : Sets default values of GL parameters in accordance with default aspects
202//=======================================================================
203void OpenGl_Workspace::ResetAppliedAspect()
204{
4e1523ef 205 myGlContext->BindDefaultVao();
206
f838dac4 207 myHighlightStyle.Nullify();
b6472664 208 myToAllowFaceCulling = false;
f9ba5c4d 209 myAspectLineSet = &myDefaultAspectLine;
210 myAspectFaceSet = &myDefaultAspectFace;
b6472664 211 myAspectFaceApplied.Nullify();
f9ba5c4d 212 myAspectMarkerSet = &myDefaultAspectMarker;
b6472664 213 myAspectMarkerApplied.Nullify();
f9ba5c4d 214 myAspectTextSet = &myDefaultAspectText;
8d1a539c 215 myGlContext->SetPolygonOffset (Graphic3d_PolygonOffset());
26395493 216
f9ba5c4d 217 ApplyAspectLine();
218 ApplyAspectFace();
219 ApplyAspectMarker();
220 ApplyAspectText();
ac116c22 221
b6472664 222 myGlContext->SetTypeOfLine (myDefaultAspectLine.Aspect()->Type());
223 myGlContext->SetLineWidth (myDefaultAspectLine.Aspect()->Width());
26395493 224}
bf75be98 225
a6df1715 226// =======================================================================
227// function : SetDefaultPolygonOffset
228// purpose :
229// =======================================================================
230Graphic3d_PolygonOffset OpenGl_Workspace::SetDefaultPolygonOffset (const Graphic3d_PolygonOffset& theOffset)
231{
232 Graphic3d_PolygonOffset aPrev = myDefaultAspectFace.Aspect()->PolygonOffset();
233 myDefaultAspectFace.Aspect()->SetPolygonOffset (theOffset);
234 if (myAspectFaceApplied == myDefaultAspectFace.Aspect()
235 || myAspectFaceApplied.IsNull()
236 || (myAspectFaceApplied->PolygonOffset().Mode & Aspect_POM_None) == Aspect_POM_None)
237 {
238 myGlContext->SetPolygonOffset (theOffset);
239 }
240 return aPrev;
241}
242
38a0206f 243// =======================================================================
c357e426 244// function : SetAspectLine
38a0206f 245// purpose :
246// =======================================================================
f9ba5c4d 247const OpenGl_AspectLine* OpenGl_Workspace::SetAspectLine (const OpenGl_AspectLine* theAspect)
38a0206f 248{
f9ba5c4d 249 const OpenGl_AspectLine* aPrevAspectLine = myAspectLineSet;
250 myAspectLineSet = theAspect;
251 return aPrevAspectLine;
c357e426 252}
38a0206f 253
c357e426 254// =======================================================================
255// function : SetAspectFace
256// purpose :
257// =======================================================================
f9ba5c4d 258const OpenGl_AspectFace * OpenGl_Workspace::SetAspectFace (const OpenGl_AspectFace* theAspect)
c357e426 259{
f9ba5c4d 260 const OpenGl_AspectFace* aPrevAspectFace = myAspectFaceSet;
261 myAspectFaceSet = theAspect;
262 return aPrevAspectFace;
c357e426 263}
38a0206f 264
c357e426 265// =======================================================================
266// function : SetAspectMarker
267// purpose :
268// =======================================================================
f9ba5c4d 269const OpenGl_AspectMarker* OpenGl_Workspace::SetAspectMarker (const OpenGl_AspectMarker* theAspect)
c357e426 270{
f9ba5c4d 271 const OpenGl_AspectMarker* aPrevAspectMarker = myAspectMarkerSet;
272 myAspectMarkerSet = theAspect;
273 return aPrevAspectMarker;
c357e426 274}
f978241f 275
c357e426 276// =======================================================================
277// function : SetAspectText
278// purpose :
279// =======================================================================
f9ba5c4d 280const OpenGl_AspectText * OpenGl_Workspace::SetAspectText (const OpenGl_AspectText* theAspect)
c357e426 281{
f9ba5c4d 282 const OpenGl_AspectText* aPrevAspectText = myAspectTextSet;
283 myAspectTextSet = theAspect;
284 return aPrevAspectText;
c357e426 285}
38a0206f 286
c357e426 287// =======================================================================
f9ba5c4d 288// function : ApplyAspectFace
c357e426 289// purpose :
290// =======================================================================
f9ba5c4d 291const OpenGl_AspectFace* OpenGl_Workspace::ApplyAspectFace()
c357e426 292{
c357e426 293 if (myView->BackfacingModel() == Graphic3d_TOBM_AUTOMATIC)
38a0206f 294 {
b6472664 295 bool toSuppressBackFaces = myToAllowFaceCulling
296 && myAspectFaceSet->Aspect()->ToSuppressBackFaces();
297 if (toSuppressBackFaces)
f978241f 298 {
25c35042 299 if (myAspectFaceSet->Aspect()->InteriorStyle() == Aspect_IS_HATCH
300 || myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Blend
c40eb6b9 301 || myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_Mask
302 || (myAspectFaceSet->Aspect()->AlphaMode() == Graphic3d_AlphaMode_BlendAuto
303 && myAspectFaceSet->Aspect()->FrontMaterial().Transparency() != 0.0f))
c357e426 304 {
b6472664 305 // disable culling in case of translucent shading aspect
306 toSuppressBackFaces = false;
f978241f 307 }
f978241f 308 }
b6472664 309 myGlContext->SetCullBackFaces (toSuppressBackFaces);
f978241f 310 }
311
b6472664 312 if (myAspectFaceSet->Aspect() == myAspectFaceApplied
8613985b 313 && myHighlightStyle == myAspectFaceAppliedWithHL)
a2e4f780 314 {
f9ba5c4d 315 return myAspectFaceSet;
a2e4f780 316 }
8613985b 317 myAspectFaceAppliedWithHL = myHighlightStyle;
a2e4f780 318
c357e426 319#if !defined(GL_ES_VERSION_2_0)
b6472664 320 const Aspect_InteriorStyle anIntstyle = myAspectFaceSet->Aspect()->InteriorStyle();
321 if (myAspectFaceApplied.IsNull()
f9ba5c4d 322 || myAspectFaceApplied->InteriorStyle() != anIntstyle)
b86bb3df 323 {
c357e426 324 switch (anIntstyle)
760c21c2 325 {
c357e426 326 case Aspect_IS_EMPTY:
327 case Aspect_IS_HOLLOW:
ee51a9fe 328 {
6d0e6be5 329 myGlContext->SetPolygonMode (GL_LINE);
c357e426 330 break;
ee51a9fe 331 }
c357e426 332 case Aspect_IS_HATCH:
62e1beed 333 {
6d0e6be5 334 myGlContext->SetPolygonMode (GL_FILL);
335 myGlContext->SetPolygonHatchEnabled (true);
c357e426 336 break;
62e1beed 337 }
c357e426 338 case Aspect_IS_SOLID:
339 case Aspect_IS_HIDDENLINE:
340 {
6d0e6be5 341 myGlContext->SetPolygonMode (GL_FILL);
342 myGlContext->SetPolygonHatchEnabled (false);
c357e426 343 break;
344 }
345 case Aspect_IS_POINT:
38a0206f 346 {
6d0e6be5 347 myGlContext->SetPolygonMode (GL_POINT);
c357e426 348 break;
38a0206f 349 }
38a0206f 350 }
91c60b57 351 }
e276548b 352
c357e426 353 if (anIntstyle == Aspect_IS_HATCH)
91c60b57 354 {
6d0e6be5 355 myGlContext->SetPolygonHatchStyle (myAspectFaceSet->Aspect()->HatchStyle());
c357e426 356 }
357#endif
38a0206f 358
c357e426 359 // Aspect_POM_None means: do not change current settings
b6472664 360 if ((myAspectFaceSet->Aspect()->PolygonOffset().Mode & Aspect_POM_None) != Aspect_POM_None)
c357e426 361 {
8d1a539c 362 myGlContext->SetPolygonOffset (myAspectFaceSet->Aspect()->PolygonOffset());
38a0206f 363 }
c357e426 364
8613985b 365 // Case of hidden line
366 if (myAspectFaceSet->Aspect()->InteriorStyle() == Aspect_IS_HIDDENLINE)
367 {
368 // copy all values including line edge aspect
dc89236f 369 *myAspectFaceHl.Aspect() = *myAspectFaceSet->Aspect();
8613985b 370 myAspectFaceHl.SetAspectEdge (myAspectFaceSet->AspectEdge());
dc89236f 371 myAspectFaceHl.Aspect()->SetShadingModel (Graphic3d_TOSM_UNLIT);
8613985b 372 myAspectFaceHl.Aspect()->SetInteriorColor (myView->BackgroundColor().GetRGB());
dc89236f 373 myAspectFaceHl.SetNoLighting();
8613985b 374 myAspectFaceSet = &myAspectFaceHl;
375 }
376 else
a174a3c5 377 {
a1073ae2 378 myGlContext->SetShadingMaterial (myAspectFaceSet, myHighlightStyle);
c357e426 379 }
62e1beed 380
b6472664 381 if (myAspectFaceSet->Aspect()->ToMapTexture())
c357e426 382 {
cc8cbabe 383 myGlContext->BindTextures (myAspectFaceSet->TextureSet (myGlContext));
83da37b1 384 }
385 else
386 {
cc8cbabe 387 myGlContext->BindTextures (myEnvironmentTexture);
a174a3c5 388 }
389
b6472664 390 myAspectFaceApplied = myAspectFaceSet->Aspect();
f9ba5c4d 391 return myAspectFaceSet;
c357e426 392}
a174a3c5 393
c357e426 394// =======================================================================
f9ba5c4d 395// function : ApplyAspectMarker
c357e426 396// purpose :
397// =======================================================================
f9ba5c4d 398const OpenGl_AspectMarker* OpenGl_Workspace::ApplyAspectMarker()
c357e426 399{
b6472664 400 if (myAspectMarkerSet->Aspect() != myAspectMarkerApplied)
ee51a9fe 401 {
b6472664 402 if (myAspectMarkerApplied.IsNull()
403 || (myAspectMarkerSet->Aspect()->Scale() != myAspectMarkerApplied->Scale()))
ee51a9fe 404 {
c357e426 405 #if !defined(GL_ES_VERSION_2_0)
b6472664 406 glPointSize (myAspectMarkerSet->Aspect()->Scale());
c357e426 407 #endif
ee51a9fe 408 }
b6472664 409 myAspectMarkerApplied = myAspectMarkerSet->Aspect();
38a0206f 410 }
f9ba5c4d 411 return myAspectMarkerSet;
679ecdee 412}
413
414// =======================================================================
c357e426 415// function : Width
679ecdee 416// purpose :
417// =======================================================================
c357e426 418Standard_Integer OpenGl_Workspace::Width() const
679ecdee 419{
c357e426 420 return !myView->GlWindow().IsNull() ? myView->GlWindow()->Width() : 0;
421}
679ecdee 422
c357e426 423// =======================================================================
424// function : Height
425// purpose :
426// =======================================================================
427Standard_Integer OpenGl_Workspace::Height() const
428{
429 return !myView->GlWindow().IsNull() ? myView->GlWindow()->Height() : 0;
430}
679ecdee 431
679ecdee 432// =======================================================================
c357e426 433// function : FBOCreate
679ecdee 434// purpose :
435// =======================================================================
b128c892 436Handle(OpenGl_FrameBuffer) OpenGl_Workspace::FBOCreate (const Standard_Integer theWidth,
437 const Standard_Integer theHeight)
679ecdee 438{
c357e426 439 // activate OpenGL context
440 if (!Activate())
b128c892 441 return Handle(OpenGl_FrameBuffer)();
c357e426 442
443 // create the FBO
444 const Handle(OpenGl_Context)& aCtx = GetGlContext();
cc8cbabe 445 aCtx->BindTextures (Handle(OpenGl_TextureSet)());
b128c892 446 Handle(OpenGl_FrameBuffer) aFrameBuffer = new OpenGl_FrameBuffer();
3c4b62a4 447 if (!aFrameBuffer->Init (aCtx, theWidth, theHeight, GL_RGBA8, GL_DEPTH24_STENCIL8, 0))
679ecdee 448 {
c357e426 449 aFrameBuffer->Release (aCtx.operator->());
b128c892 450 return Handle(OpenGl_FrameBuffer)();
679ecdee 451 }
b128c892 452 return aFrameBuffer;
679ecdee 453}
454
455// =======================================================================
c357e426 456// function : FBORelease
679ecdee 457// purpose :
458// =======================================================================
b128c892 459void OpenGl_Workspace::FBORelease (Handle(OpenGl_FrameBuffer)& theFbo)
679ecdee 460{
c357e426 461 // activate OpenGL context
462 if (!Activate()
b128c892 463 || theFbo.IsNull())
62e1beed 464 {
62e1beed 465 return;
466 }
c357e426 467
b128c892 468 theFbo->Release (GetGlContext().operator->());
469 theFbo.Nullify();
c357e426 470}
62e1beed 471
f9f740d6 472// =======================================================================
473// function : BufferDump
474// purpose :
475// =======================================================================
476Standard_Boolean OpenGl_Workspace::BufferDump (const Handle(OpenGl_FrameBuffer)& theFbo,
477 Image_PixMap& theImage,
478 const Graphic3d_BufferType& theBufferType)
c357e426 479{
6cde53c4 480 return !theImage.IsEmpty()
481 && Activate()
482 && OpenGl_FrameBuffer::BufferDump (GetGlContext(), theFbo, theImage, theBufferType);
679ecdee 483}
91c60b57 484
91c60b57 485// =======================================================================
a1073ae2 486// function : ShouldRender
91c60b57 487// purpose :
488// =======================================================================
1b661a81 489bool OpenGl_Workspace::ShouldRender (const OpenGl_Element* theElement)
91c60b57 490{
1b661a81 491 // render only non-raytracable elements when RayTracing is enabled
492 if ((myRenderFilter & OpenGl_RenderFilter_NonRaytraceableOnly) != 0)
493 {
494 if (OpenGl_Raytrace::IsRaytracedElement (theElement))
495 {
496 return false;
497 }
498 }
499 else if ((myRenderFilter & OpenGl_RenderFilter_FillModeOnly) != 0)
500 {
501 if (!theElement->IsFillDrawMode())
502 {
503 return false;
504 }
505 }
506
507 // handle opaque/transparency render passes
508 if ((myRenderFilter & OpenGl_RenderFilter_OpaqueOnly) != 0)
509 {
510 if (!theElement->IsFillDrawMode())
511 {
512 return true;
513 }
514
515 if (OpenGl_Context::CheckIsTransparent (myAspectFaceSet, myHighlightStyle))
516 {
517 ++myNbSkippedTranspElems;
518 return false;
519 }
520 }
521 else if ((myRenderFilter & OpenGl_RenderFilter_TransparentOnly) != 0)
91c60b57 522 {
1b661a81 523 if (!theElement->IsFillDrawMode())
524 {
525 if (dynamic_cast<const OpenGl_AspectFace*> (theElement) == NULL)
526 {
527 return false;
528 }
529 }
530 else if (!OpenGl_Context::CheckIsTransparent (myAspectFaceSet, myHighlightStyle))
531 {
532 return false;
533 }
91c60b57 534 }
1b661a81 535 return true;
91c60b57 536}