-
-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] ImageWithRgba and ImageWithFile internal state incorrectly indexed (incorrect internal keys) #509
Comments
well, I believe, that this particular case (of ImageWidget) could be solved by increasing complexity of widget's ID base id: GenAutoID("ImageWithRgba" /* <- put here something more complex */) what do you think about it @AllenDang ? |
Using a checksum shouldn't be necessary unless this is supposed to be safe for direct image manipulation, too. Shouldn't it just involve a pointer comparison otherwise? I agree setting a new ID is a reasonable way to solve the issue, after all the programmer knows when the image is changed. But is there a public API for it? |
@rasteric I just added ID setter to ImageWithRgbaWidget and ImageWithFileWidget update to newest master branch to get it. |
@AllenDang i'd add a comment over ImageWidget pointing to this issue as well And perhaps over GenAutoID too |
it looks like something wrong with internal imgui texture handling... hard to say without code. |
I'll try to get a minimal code example together as soon as I have time. :) |
What happend?
ImageWithRgba and ImageWithFile maintain internal state in Context. However, this information is not updated correctly when new image widgets with new images are created in the render loop but the total number of widgets remains the same. The symptom of this problem is that if a window displays n widgets, and one of them is an image widget and a new image widget with another image is created, then the GUI sometimes displays the old image.
The reason seems to be that the widget's internal id is created with
GenAutoID
but this function only uses a string based on e.g. "ImageWithRgba" plus a simple widget counter:This does not seem to be fine-grained enough to store image textures in the context when the image changes (calling e.g.
ImageWithRgba
with different images in the render loop) but the total number of widgets remains constant. Problems with other widgets might also occur if they use the ID to store state in the context.Code example
main.go
To Reproduce
The reason is presumably that the internal context state is only changed when the widget count changes, which is caused when the slider is all the way to the right.
Version
(latest)
OS
Linux Mint 20.3 Cinnamom
The text was updated successfully, but these errors were encountered: