I have a problem with z clipping. I think clipping plane's position (ZSize?) is calculated initially and if ZSize of an object is too small (initially), the rear (long end) of the object is cut with clipping plane when I try to rotate the object. How can solve this problem? (I hope I could express myself :)
Currently, just after loading the object, I rotate view (top,left,front views), find max ZSize of this views and setZSize as maxZSize. But I think there should be better way instead of rotating for different angles.

Roman Lygin's picture

Not an expert in OpenGl, and don't know the deep internals of OCC regarding Z clipping. However, never noticed its need in real applications.
Look at Viewer3D example shipped with OCC (on Windows), perhaps it can be of some help (there is a button and a dialog box managing ZClipping settings). You can have a look what it does internally.

Bounding box of a shape can be calculated using Bnd_Box and BRepBndLib::Add (aShape, aBox).

Hope this will be of any help.

xaeroxx's picture

Thanks, but there are also meshes and it shouldn't depend on bounding boxes of shapes. Any suggestion?

Maili's picture

I have also similar problem with clipping. Although there is no clipping plane on view, shape can be clipped when rotating (sometimes clips rear sometimes front) I would be thankful for any suggestion..

Adrian's picture

I also have the same problem. Cam someone help us, please?

Roman Lygin's picture

My 2 cents. Never investigated this but noticed that OCC samples have a call to V3d_View3d::ZFitAll() presumably to fix Z clipping. You might want to check the source code on what it does.
--- - the Open CASCADE blog