You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a new buffer if necessary when setting an existing Graphic #869
We can implement this pretty easily, would make things easier for users, tradeoff is that users are less aware that setting data this way is slower than setting data that fits in an existing buffer. We can just document it well.
image=fig[0, 0].add_image(np.random.rand(10, 10))
# allow this, internally delete the existing buffer # and world object and create a new oneimage.data=np.random.rand(20, 20)
Might not have to create a new world object, might be possible to just replace the geometry I think.
I think this would be more flexible, but I think it is only worth doing if we are able to handle the change without creating a new world object.
We should also probably benchmark here how much time this would really take. Imagine you are trying to change the data to something much larger: np.random.rand(3_000, 3_000). Maybe it would be more cost-efficient to just remove the graphic and add a new one, but idk
Yea this should be be benchmarked and good idea with keeping the world object because events are actually added to it.
For this to work the buffer reference on the buffer manager needs to be changed as well as on the geometry, and garbage collection must occur if the buffer is isolated.
changed the title [-]Create a new buffer and world object if necessary when setting an existing Graphic[/-][+]Create a new buffer if necessary when setting an existing Graphic[/+]on Dec 2, 2025
I've started implementing this, will make the NDWidget easier in some ways.
I'm going to get rid of isolated_buffer, because that was only for special usecases if you wanted to use a huge buffers on the GPU and not create a new huge buffer on system RAM as well. However, OOC rendering and LOD levels is the better way to do this.
Activity
clewis7 commentedon Jun 30, 2025
I think this would be more flexible, but I think it is only worth doing if we are able to handle the change without creating a new world object.
We should also probably benchmark here how much time this would really take. Imagine you are trying to change the data to something much larger:
np.random.rand(3_000, 3_000). Maybe it would be more cost-efficient to just remove the graphic and add a new one, but idkkushalkolar commentedon Jul 1, 2025
Yea this should be be benchmarked and good idea with keeping the world object because events are actually added to it.
For this to work the buffer reference on the buffer manager needs to be changed as well as on the geometry, and garbage collection must occur if the buffer is isolated.
kushalkolar commentedon Oct 18, 2025
I also wonder how this could be done such that if the buffer is shared between objects, the shared buffer updates too 🤔
kushalkolar commentedon Dec 1, 2025
I got a better idea of how to do this after doing polygon vertex data stuff in #954
[-]Create a new buffer and world object if necessary when setting an existing Graphic[/-][+]Create a new buffer if necessary when setting an existing Graphic[/+]kushalkolar commentedon Jan 13, 2026
I've started implementing this, will make the NDWidget easier in some ways.
I'm going to get rid of
isolated_buffer, because that was only for special usecases if you wanted to use a huge buffers on the GPU and not create a new huge buffer on system RAM as well. However, OOC rendering and LOD levels is the better way to do this.kushalkolar commentedon Aug 4, 2026
done in #869