![Anton Shabalin's picture Anton Shabalin's picture](https://dev.opencascade.org/sites/default/files/styles/user/public/pictures/picture-7247-1633613439.jpg?itok=lLJjglPP)
Wed, 05/17/2017 - 05:49
Forums:
Hello,
Is it possible to draw one AIS_Shape on multiple V3d_Viewers?
The point is that I've created several windows (each have it's own GL Context and OpenGl_GraphicDriver) and I need to display the same Shape with different projections. Furthermore I need the selection equally work in different windows.I know that several V3d_View-s can show the same AIS_InteractiveContext.
But to create V3d_View I need the same V3d_Viewer.
Or maybe I need to create multiple Prs3d_Presentation ?
Any help is apreciated.
Wed, 05/17/2017 - 09:38
AIS architecture had some background for managing the same AIS_InteractiveObject within multiple AIS_InteractiveContext instances - e.g. each AIS_InteractiveObject holds a list of presentations which can be created for different Presentation Managers.
But at the same time AIS had several implementation details which made such combination practically ill-working - e.g. each AIS_InteractiveObject holds a pointer to a AIS_InteractiveContext where it was displayed, and it is used for some operations. It is just one of the pitfalls, there are more actually. This produces the situation when AIS implicitly allowed adding Object to different Context, however in reality such combinations have undefined behavior and various bugs. New selection management logic introduced since OCCT 6.9.0 completely ruined such scenario because selection stopped worked correctly in this case.
Therefore, since OCCT 7.1.0 AIS_InteractiveContext explicitly disallows such behavior - trying to add an Object already displayed in another Context will raise a runtime exception (bug #0027957).
Note that this particular feature is not a big deal for your case, since Presentations should be duplicated anyway when using multiple Graphic Drivers (e.g. no memory usage benefits on reusing single AIS_InteractiveObject) and selection works independently for each AIS_InteractiveContext (e.g. no synchronization like in case of multiple V3d_View within shared V3d_Viewer). So if you really need such behavior, you have to implement synchronization on application level.
Wed, 05/17/2017 - 12:11
Kirill,
Thank you for the answer. Could you please give me some little workable example (url) for creating Presentations of AIS_InteractiveObject and showing it at the AIS_InteractiveContext ?
Thanks.
Wed, 05/17/2017 - 13:24
Sorry, I don't get your question. I suppose you already did it by creating AIS_Shape presentations.
Thu, 05/18/2017 - 17:04
Ok. Thanks. I think I understood now.