Fix for flickering imgui when switching renderer

Use the geometry from last frame in ImguiBackend::CreateRenderResources if
available.
This commit is contained in:
Attila Uygun 2023-11-02 21:48:39 +01:00
parent 61a96c7988
commit 8b149bf8f4
1 changed files with 3 additions and 0 deletions

View File

@ -80,7 +80,10 @@ void ImguiBackend::Shutdown() {
void ImguiBackend::CreateRenderResources(Renderer* renderer) { void ImguiBackend::CreateRenderResources(Renderer* renderer) {
renderer_ = renderer; renderer_ = renderer;
shader_->SetRenderer(renderer); shader_->SetRenderer(renderer);
geometries_.clear(); geometries_.clear();
if (ImGui::GetCurrentContext() && ImGui::GetDrawData())
Render();
auto source = std::make_unique<ShaderSource>(); auto source = std::make_unique<ShaderSource>();
if (source->Load("engine/imgui.glsl")) { if (source->Load("engine/imgui.glsl")) {