Closed LPFOXX closed 6 days ago
, that the contents of the selected tab is rendered in (almost) every frame
Everything in Dear ImGui is rendered every frame. Your question doesn't seem to make much sense to me, it appears to be a mix of a XY Problem and/or premature optimization.
In order to prevent those properties being set on every frame, I'd like to have a tab that behaved like a ImGui::Button - that is, returns true when the tab is selected, added to the tab bar or switched to.
There is a already a tab item that behave like a button: ImGui::TabItemButton()
.
But what you describe in your sentence is not the behavior of a button. A button returns true when pressed.
If you need to cache e.g. contents into an image since you are going to need to store that image somewhere, you can simply store e.g. the last value of ImGui::GetFrameCount()
where the contents was displayed, and compare that to invalidate your image.
But my assumption is that you are going against the direction of what dear imgui is powerful for and efficient at.
I appreciate the quick response.
I agree that I might have overstepped a little bit.
As for the the ImGui::TabItemButton
I am aware of it. I had already tried using it, but I noticed it does not resemble the style of a regular tab.
I guess this issue may now be closed.
Thx
Version/Branch of Dear ImGui:
Version 1.90, Branch: docking
Back-ends:
imgui_impl_glfw.cpp +imgui_impl_opengl3.cpp
Compiler, OS:
Windows 11 + MSVC 2022
Full config/build information:
Details:
My Issue/Question:
I have a window with a tab bar and I dynamically add tabs to it. I noticed, however, that the contents of the selected tab is rendered in (almost) every frame - taking into account tabs deferred rendering.
I am setting some properties whenever a tab is selected/added, which are then used to render to a framebuffer below using
ImGui::Image
, effectively showing the contents of the selected tab item.In order to prevent those properties being set on every frame, I'd like to have a tab that behaved like a
ImGui::Button
- that is, returnstrue
when the tab is selected, added to the tab bar or switched to.Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code: