
Thu, 04/26/2018 - 12:14
Hello,
I'm trying to compute the "projected" 3D position of the mouse when it's hovering graphical objects (eg AIS_Shape). To this end I'm trying to use the depth buffer as explained in this article (though I'm concerned only with the orthographic case).
To retrieve the depth buffer I'm calling V3d_View::ToPixMap() and pass Graphic3d_BT_Depth as the buffer type, but I always get an empty "image" containing only the trihedron (enabled in the view with V3d_View::TriedronDisplay()).
To view the contents of the depth buffer image I convert from "4bytes float grayscale" to a Qt's QImage with format QImage::Format_Grayscale8. See the attached picture for example.
Is retrieval of the depth buffer from V3d_View supposed to work ? Have anyone already used this ?
Thu, 04/26/2018 - 12:29
Since OCCT started using multiple Z-layers by default with Depth Buffer clears in-between,
V3d_View::ToPixMap() with Graphic3d_BT_Depth become producing semi-broken / unexpected results.
This is because Frame buffer dump is performed after redrawing entire scene, so that at the end only content of last Z-Layer become available in Depth Buffer.
To solve this issue, ToPixMap() should be extended to specify exactly which layers should be dumped.
For that, you can provide a patch for OCCT or contact Support Services if this problem is important for you.
Note, however, that your specific problem is usually solved by using standard AIS tools - e.g. by picking detection results from Selection Manager after MoveTo().
Wed, 05/02/2018 - 13:33
Hello Kirill,
Thanks for your answer, I tried to go with your suggestion with using the AIS tools. After looking at the interesting headers and sources I can't find how to retrieve interesting picking results. Please can you give some basic hints ?
Wed, 05/02/2018 - 22:19
I would suggest looking into source code of Draw Harness command vstate, which seems to be prints some information, that can be useful in your case:
Wed, 06/13/2018 - 20:17
Thanks for your help, I could make it work, by simply using SelectMgr_ViewerSelector::PickedPoint() as in real code here :
https://github.com/fougue/mayo/blob/develop/src/mainwindow.cpp#L190
See it a bit in action with that screencast at the end of the README page from my on-going Mayo project (develop branch) :
https://github.com/fougue/mayo/tree/develop