diff --git a/src/DGtal/io/Display3D.h b/src/DGtal/io/Display3D.h index aa9b01c91b..d09cef774d 100644 --- a/src/DGtal/io/Display3D.h +++ b/src/DGtal/io/Display3D.h @@ -896,6 +896,8 @@ namespace DGtal /// std::set mySelectCallBackFcts; + bool myBoundingPtChangedTag = false; + //----end of protected datas // ------------------------- Internals ------------------------------------ diff --git a/src/DGtal/io/Display3D.ih b/src/DGtal/io/Display3D.ih index c9b429501a..d2c183f41e 100644 --- a/src/DGtal/io/Display3D.ih +++ b/src/DGtal/io/Display3D.ih @@ -1191,16 +1191,42 @@ DGtal::Display3D< Space ,KSpace >::updateBoundingBox(const RealPoint &p) myBoundingPtUp[1]= p[1]; myBoundingPtUp[2]= p[2]; myBoundingPtEmptyTag = false; + myBoundingPtChangedTag = true; } else { - if(p[0] myBoundingPtUp[0]) myBoundingPtUp[0]= p[0]; - if(p[1] >myBoundingPtUp[1]) myBoundingPtUp[1]= p[1]; - if(p[2] >myBoundingPtUp[2]) myBoundingPtUp[2]= p[2]; + if(p[0] myBoundingPtUp[0]) + { + myBoundingPtUp[0]= p[0]; + myBoundingPtChangedTag = true; + } + if(p[1] >myBoundingPtUp[1]) + { + myBoundingPtUp[1]= p[1]; + myBoundingPtChangedTag = true; + } + if(p[2] >myBoundingPtUp[2]) + { + myBoundingPtUp[2]= p[2]; + myBoundingPtChangedTag = true; + } } } diff --git a/src/DGtal/io/viewers/Viewer3D.ih b/src/DGtal/io/viewers/Viewer3D.ih index bd55597198..2e2b7732cc 100644 --- a/src/DGtal/io/viewers/Viewer3D.ih +++ b/src/DGtal/io/viewers/Viewer3D.ih @@ -1098,8 +1098,7 @@ DGtal::Viewer3D::updateList ( bool needToUpdateBoundingBox ) // Seventh list: Textured images. glUpdateTextureImages(myGSImageList); - - if ( needToUpdateBoundingBox ) + if ( needToUpdateBoundingBox && Viewer3D::myBoundingPtChangedTag ) { setSceneBoundingBox ( qglviewer::Vec ( Viewer3D::myBoundingPtLow[0], Viewer3D::myBoundingPtLow[1], @@ -1108,7 +1107,9 @@ DGtal::Viewer3D::updateList ( bool needToUpdateBoundingBox ) Viewer3D::myBoundingPtUp[1], Viewer3D::myBoundingPtUp[2] ) ); showEntireScene(); + Viewer3D::myBoundingPtChangedTag = false; } + updateGL(); glPopMatrix(); }