Texture Buffer Object (TBO) and Instancing
I would like to use TBOs to store instances transformations to a special 1D samplerBuffer, and I successfully coded a test application for using this 1D samplerBuffer.
At the moment I'm using one TBO for each model and I'm updating TBO's float data according to model's instances translation and rotation. With constant number of models and instance there isn't any problem because relative TBOs size remains the same and I just need to update data in same buffer index positions.
My hierarchical structure for models with instances:
- TextureBufferObject (containing 2 instances data)
- Visible Instances Count (to not parse, again, whole list at every render loop)
- TextureBufferObject (containing 1 instance data)
- Visible Instances Count
For each Model structure I've attached a different TBO which contains its model's instances transformations.
Now the problem: sometimes a Model Instance could became temporarily invisible, frustum/occlusion culled or permanently deleted (due to time elapsed) between two different rendered frames, and I should remove its instance's transformation floats from Model's TBO.
Removing those floats needs to re-size TBO and upload whole modified buffer again.
Is this the right way? One TBO for each Model?
Thanks in advance for any help!