MantisBT - Open CASCADE
View Issue Details
0024224Open CASCADE[OCCT] OCCT:Visualizationpublic2013-10-04 19:042013-12-19 13:58
dbp 
bugmaster 
normalminor 
closedfixed 
ALL
[OCCT] 6.7.0 
[OCCT] 6.7.0[OCCT] 6.7.0 
bugs vis bug24224
0024224: Suspicious logics in changing clipping planes at OpenGl_Structure
The following piece of code seems to produce bugs for crossing lists of clippings between view and structure:

void OpenGl_Structure::Render(..)
{
..

  // Collect planes which should be turned on for structure
  Graphic3d_SetOfHClipPlane aPlanesOn;
  Graphic3d_SetOfHClipPlane::Iterator aPlaneIt (myClipPlanes);
  for (; aPlaneIt.More(); aPlaneIt.Next())
  {
    const Handle(Graphic3d_ClipPlane)& aUserPln = aPlaneIt.Value();
    if (aUserPln->IsOn())
      aPlanesOn.Add (aUserPln);
  }

  // Set structure clipping planes
  if (aPlanesOn.Size() > 0)
  {
    aContext->ChangeClipping().Set (aPlanesOn, AWorkspace->ViewMatrix());
  }

 ... unset would remove the planes in case of crossing lists

  // unset structure clipping planes
  if (aPlanesOn.Size() > 0)
  {
    aContext->ChangeClipping().Unset (aPlanesOn);
  }

...

}

Provide stencil buffer for 3D viewer image dump functionality.
pload AISV MODELING
vinit
box b1 0 0 0 10 10 10
box b2 30 0 0 10 40 10
box b3 -30 0 0 20 20 20
vsetdispmode 1
vdisplay b1 b2 b3
## test view-level clipping
vclipplane create pln1
vclipplane change pln1 equation 0 1 0 -5
vclipplane change pln1 capping on
vclipplane change pln1 capping color 0.9 0.9 0.9
vclipplane set pln1 view Driver1/Viewer1/View1
## test sharing of planes between view and object
vclipplane set pln1 object b1
## test object-level clipping
vclipplane create pln2
vclipplane change pln2 equation -0.707 0.707 0 -25
vclipplane change pln2 capping on
vclipplane change pln2 capping color 0.5 0.5 0.9
vclipplane change pln2 capping hatch on
vclipplane set pln2 object b3
vfit
This patch contains solution for several issues:
1) The reported problem dedicated to suspicious operations which activating/deactivating list of clip planes during rendering. Due to logical mistake a set of clip planes, shared between view and more than one structure, was not applied completely for second and the latter structures (numeration here corresponds to position of structures in rendering pipeline) - the clip planes of view were not accounted for these structures.

2) The patch contains solution for issues 0024189, 0024229. All these issues are interrelated and have cross-dependencies.

3) Missed test case for checking OpenGl-rendered cappings (issue #0024070) is added by this patch.

Changes:

- No changes to public API.
- Internal changes:
  a) Added support for stencil buffer
     OpenGl_FrameBuffer.hxx
     OpenGl_FrameBuffer.cxx
     OpenGl_FrameBuffer::Init (...)

  b) Improved interface of clip plane state management to avoid performance regressions; fixed code remarks.
  c) Problem with clip planes sharing between view and structures has been fixed
     OpenGl_ClipPlaneState.cxx
     OpenGl_ClipPlaneState.hxx
     OpenGl_Structure.cxx
     OpenGl_Structure::Render (...)
No tags attached.
related to 0024189closed apl Open CASCADE Rendering performance regression after implementation of per-object clipping 
related to 0024229closed apl Open CASCADE Test case for 0024070 bug has not been integrated 
related to 0024253closed bugmaster Open CASCADE FBO: Improper deletion of combined Stencil+Depth RenderBuffer 
png 24224.png (62,784) 2013-10-08 14:32
https://tracker.dev.opencascade.org/
Issue History
2013-10-04 19:04dbpNew Issue
2013-10-04 19:04dbpAssigned To => apl
2013-10-04 19:04dbpNote Added: 0025911
2013-10-04 19:04dbpStatusnew => assigned
2013-10-07 09:00aplRelationship addedrelated to 0024189
2013-10-07 09:01aplRelationship addedrelated to 0024070
2013-10-08 12:26aplSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=5978#r5978
2013-10-08 14:01aplRelationship addedrelated to 0024229
2013-10-08 14:03aplSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=5983#r5983
2013-10-08 14:32aplFile Added: 24224.png
2013-10-08 14:42aplNote Added: 0025957
2013-10-08 14:42aplAssigned Toapl => kgv
2013-10-08 14:42aplStatusassigned => resolved
2013-10-08 16:22aplNote Added: 0025969
2013-10-08 17:16kgvNote Added: 0025974
2013-10-08 17:16kgvAssigned Tokgv => bugmaster
2013-10-08 17:16kgvStatusresolved => reviewed
2013-10-09 07:35aplAssigned Tobugmaster => mkv
2013-10-09 08:23kgvRelationship addedrelated to 0022779
2013-10-09 08:24kgvAdditional Information Updatedbug_revision_view_page.php?rev_id=5987#r5987
2013-10-10 10:31apnNote Added: 0026010
2013-10-10 10:31apnTest case number => bugs vis bug24224
2013-10-10 10:31apnAssigned Tomkv => bugmaster
2013-10-10 10:31apnStatusreviewed => tested
2013-10-11 10:39kgvNote Added: 0026040
2013-10-11 11:06aplRelationship addedrelated to 0024253
2013-10-11 13:35bugmasterChangeset attached => occt master b859a34d
2013-10-11 13:35bugmasterStatustested => verified
2013-10-11 13:35bugmasterResolutionopen => fixed
2013-10-17 11:18aplDescription Updatedbug_revision_view_page.php?rev_id=6045#r6045
2013-10-17 11:18aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6046#r6046
2013-10-17 11:23aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6047#r6047
2013-10-17 11:23aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6048#r6048
2013-10-17 11:27aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6050#r6050
2013-10-19 21:46aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6064#r6064
2013-10-19 21:46aplAdditional Information Updatedbug_revision_view_page.php?rev_id=6065#r6065
2013-12-19 13:51bugmasterStatusverified => closed
2013-12-19 13:58bugmasterFixed in Version => 6.7.0

Notes
(0025911)
dbp   
2013-10-04 19:04   
Dear apl,

Could you please check this issue?
(0025957)
apl   
2013-10-08 14:42   
Dear kgv,

Branch CR24224 is ready for review.

Could you please have a look at it?
(0025969)
apl   
2013-10-08 16:22   
This fix introduces solution for issue 24189.

The results prior to patch with capping & clipping (0024070):

Highest CPU performance:
FPS: 57.575139198577126
CPU: 16.380105 msec

Lowest CPU performance:
FPS: 57.685042823789502
CPU: 16.692107000000007 msec

The results after patch:

Highest CPU performance:
FPS: 58.110396973959986
CPU: 16.380105 msec

Lowest CPU performance:
FPS: 57.958128763574308
CPU: 16.848108000000011 msec

Performance compared on card: NVIDIA Quadro K4000, CPU: Core i5-3450
(0025974)
kgv   
2013-10-08 17:16   
Patch has been reviewed without remarks and ready for testing.
(0026010)
apn   
2013-10-10 10:31   
Dear BugMaster,

Branch CR24224 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: a481bc96baeed9a47018a608753dd26970f7d345

Number of compiler warnings:

occt component :
Linux: 424 (424 on master)
Windows: 9 (9 on master)

products component :
Linux: 189 (189 on master)
Windows: 287 (287 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
bugs vis bug24224 - OK

Testing on Linux:
Total MEMORY difference: 367428100 / 367264668
Total CPU difference: 43704.150000001275 / 44590.37000000126

Testing on Windows:
Total MEMORY difference: 431925044 / 433307988
Total CPU difference: 51473.28125 / 41888.375

There are not differences in images found by testdiff.
(0026040)
kgv   
2013-10-11 10:39   
+    if (!theGlContext.IsNull() && theGlContext->extFBO != NULL)
+    {
+      theGlContext->extFBO->glDeleteRenderbuffersEXT (1, &myGlStencilRBId);
+      myGlStencilRBId = NO_RENDERBUFFER;
+    }

Deletion of combined Stencil+Depth RenderBuffer will be performed twice which might lead to issues within some OpenGL implementations.