GeezerVison is showing github.com — Create a new buffer if necessary when setting an existing Graphic · Issue #869 · fastplotlib/fastplotlib
Create a new buffer if necessary when setting an existing Graphic #869DescriptionWe 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 one
image.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. Activityclewis7 commented on 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 idk kushalkolar commented on 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 commented on 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 commented on Dec 1, 2025 I got a better idea of how to do this after doing polygon vertex data stuff in #954 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, 2025kushalkolar commented on 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 commented on Aug 4, 2026
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|