-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Add flags to skip window rendering for subsequent access to drawLists. #1660
Conversation
The flags are ImGuiWindowFlags_NoBackground/NoWindow. They make it easier to create an invisible window for drawing texts outside of imgui via raw access to the draw lists as suggested in ocornut#628.
Hello, Thanks for your suggestion. I don’t feel NoBackground is necessary as you can already use SetNextWindowBgAlpha(0.0f) that’s one line of code and it’s a fairly uncommon use case. We are also running out of window flag so it’s best to not allocate them too easily. Note that you can easily allocate ImDrawList or use GetOverlayDrawList(). For a window with the flag you proposed you won’t have much control over the display order either way. Perhaps instead we could add a call to register a ImDrawList for inclusion in the draw data, with option for whether it is in the front or in the back. And/or maybe add a GetBackgroundDrawList() helper like overlay drawlist. I understand the use of something like _NoWindow but the name is a little vague and misleading here, and the choice of flags (NoInputs, NoSavedSettings) too arbitrary. Perhaps one flag to disable all the decorations would be of use. (Also the line of code you added doesn’t match the local coding style) |
Hi, Thanks for your suggestions. And most importantly thanks for imgui, I've really found it useful! I first tried drawing my screen texts with the technique you suggested in #628 ; basically setting all those flags and calling The GetOverlayDrawList() approach almost solves my problem without the use of window, except that as expected the texts render over the GUI windows, which is undesirable. So you're right that something like GetBackgroundDrawList() would come in just handy here. By the way, the flags I added to _NoWindow also come from your suggestion in #628, and I do think _NoInputs does make sense in this case (you don't want to accidentally click something you're not seeing); as for _NoSavedSettings, well, I'm fine either way; I was taking your word here. So, given the conditions that I...
... would you be able to accept this PR? Or maybe, alternatively, add GetBackgroundDrawList() and submit it in a different PR? Let me know if you're fine with either (or both, or none) of these choices. All the best, |
Hello @biojppm I looked at this today, and I don't understand those statements:
The background is already not drawn when alpha is zero.
And
That already skips rendering. I am however adding a _NoBackground as suggested by this PR, but not exactly the same as yours. The _NoBackground flag I am adding doesn't hide scrolling, resize grips like yours. The main reason for adding this is that it allows us to create combination flags to solve what we are discussing this. Without it it we can't have a flag to denote an "invisible" window, etc.
Designing this is the difficult part as many different combinations are genuinely useful. I have now added:
And reworked Given that, to achieve what you describe you can use:
And depending if you use only the drawlist with a custom clipping rectangle or not, you may set to set the window pos/size to cover the viewport you need. I would not mind adding a new flag combination to combine all 4 above but I can't find of a proper name for it now that would convey both the visual aspect (NoDecoration+NoBackground) and the inputs aspect. I also have a problem with |
…to ease creating new flag combinations. Added ImGuiWindowFlags_NoDecoration helper flag which is essentially NoTitleBar+NoResize+NoScrollbar+NoCollapse. (#1660)
Closing this now, I think the original PR is well covered enough with the flags added mid october, |
The flags are
ImGuiWindowFlags_NoBackground/NoWindow
. They make it easier to create an invisible window for drawing texts outside of imgui via raw access to the draw lists as suggested in #628. The window drawing is skipped when ImGuiWindowFlags_NoWindow is set, so this saves us from setting alpha on the window for this purpose.