Closed JTtNinjaCode closed 6 months ago
Can you clarify what you mean by flickering by capturing a video of it?
It seems to be because RenderPlatformWindowsDefault()
changes the current GL context:
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
}
And immediately after you are swapping the current GL context which is the wrong context:
glfwSwapBuffers(window);
If you look at our example, we are doing:
// Update and Render additional Platform Windows
// (Platform functions may change the current OpenGL context, so we save/restore it to make it easier to paste this code elsewhere.
// For this specific demo app we could also call glfwMakeContextCurrent(window) directly)
if (io.ConfigFlags & ImGuiConfigFlags_ViewportsEnable)
{
GLFWwindow* backup_current_context = glfwGetCurrentContext();
ImGui::UpdatePlatformWindows();
ImGui::RenderPlatformWindowsDefault();
glfwMakeContextCurrent(backup_current_context);
}
glfwSwapBuffers(window);
You can also store the main GL context and glfwMakeContextCurrent()
on it after RenderPlatformWindowsDefault()
.
oh, it works! Have you ever thought about recording some tutorial videos? Specifically about reading the imgui code and some design principles, etc. I really like this repo and hope there will be a way to learn more.
There is a Getting Started guide there: https://github.com/ocornut/imgui/wiki/Getting-Started And many tutorial videos on the internet (although maybe IMHO are of dubious quality, people making things more complicated for themselves).
And i'm trying to better populate the Wiki over time but there's so much to do.
Glad it solved your problem!
Version/Branch of Dear ImGui:
Version 1.90.6, Branch: docking (master/docking/etc.)
Back-ends:
imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler, OS:
Windows 10 + MSVC 2022
Full config/build information:
imgui config on the computer in problem.
imgui config on the computer without problem.
Details:
When I move the small window out of the main window, flickering occurs when it reaches the edge. This is a screenshot of one of the frames.
In my other computer(same as Windows 10 and MSVC 2022)this problem not occur.
The reason I encountered this issue is because I initially wanted to leverage the cross-platform capabilities of GLFW + OpenGL 3, using CMake to quickly set up an ImGui template on various platforms. Below is the link: https://github.com/JTtNinjaCode/Dear_Imgui_Template.git
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
Code, modify from you example code, but use docking branch, add viewport and docking feature. Add these code into example code with opengl3 and glfw as backends:
Full Code: