
Mon, 10/07/2024 - 15:12
Forums:
I am working on drawing a large number of identical elements (with the same geometric content but different Transforms). By using AIS_ConnectedInteractive, I can reuse the Presentation data without recalculating it repeatedly. However, even with this technique, each element still requires an individual draw call.
How can I merge these elements and draw them in a single draw call?
My primary concern is how to handle the differences in Transforms.
Tue, 10/08/2024 - 21:58
The current implementation of
AIS_ConnectedInteractive
implies that the same geometry could be rendered multiple times having different locations. This routine allows sharing graphical data (e.g. spare GPU memory), but rendering itself requires multiple draw calls.What you may do is using a larger
AIS_InteractiveObject
that would group multiple sub-objects. Even though graphical geometry will be duplicated here (more GPU memory will be required), the rendering will show much better time - which could be especially noticed on a large number of small objects grouped together. You don't need to group EVERYTHING in one object - just group in batched of reasonable size.OpenGL theoretically allows rendering the same geometry multiple times with different transformation in a single draw call via
glDrawElementsInstanced
and similar methods, but this is not that trivial to apply here, and OCCT doesn't do that for now (you may implement it on own, however, if you are familiar with OpenGL by subclassingOpenGl_Group
/OpenGl_PrimitiveArray
).