You may try different strategies depending on the nature of your data.
I. Mutable array of primitives.
This approach would preallocate VBO on GPU level,
which will be sequentially modified afterwards.
1. If your input data is unindexed.
- Preallocate Graphic3d_AttribBuffer with the maximum amount of points
you expect to be streamed or of a reasonable size for grouping.
- Make it mutable (Graphic3d_AttribBuffer::SetMutable()) and interleaved (default).
- Fill in first portion of the data, assign number of defined points Graphic3d_AttribBuffer::NbElements
(should be smaller Graphic3d_AttribBuffer::NbMaxElements() specified on construction),
and invalidate sub-range via Graphic3d_AttribBuffer::Invalidate();
- Fill in other portions of the data, started from previously initialized portion.
2. If your input data is indexed.
- You'll have to upload all vertex attributes first,
and then you might use Graphic3d_MutableIndexBuffer
to stream which indices to display.
II. Multiple VBOs.
This approach considers that you create new Graphic3d_ArrayOfPrimitives,
while preserving previosly computed ones.
The main challenge is to avoid reuploads of data to GPU.
- The simplest way would be creating a new AIS_InteractiveObject
instance for each new streamed VBO.
- You may also use a single AIS_InteractiveObject
and add new groups/primitive arrays to existing Prs3d_Presentation,
created by last AIS_InteractiveObject::Compute() call
(but avoid recomputing presentation).
This would require implementing some hacks.
- You may also create multiple Prs3d_Presentation within the same
AIS_InteractiveObject (but would also require some hacks to avoid bugs).
This is for updating visualization part.
For selection part you'll have to implement custom ::ComputeSelection().
But as this doesn't involve interoperation with OpenGL,
this layer is more straightforward to profile and optimize for performance
(like caching BVH sub-trees for each primitive array sub-group).