From 25e2427d131794ee9c191317cb47ffd88541db82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <tmueller@nvidia.com> Date: Mon, 30 Jan 2023 14:19:47 +0100 Subject: [PATCH] Always load imgui.ini from the instant-ngp root directory --- src/testbed.cu | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/testbed.cu b/src/testbed.cu index 9cd0282..99b80c4 100644 --- a/src/testbed.cu +++ b/src/testbed.cu @@ -2914,7 +2914,6 @@ void Testbed::init_window(int resw, int resh, bool hidden, bool second_window) { tlog::success() << "Initialized OpenGL version " << glGetString(GL_VERSION); - glfwSetWindowUserPointer(m_glfw_window, this); glfwSetDropCallback(m_glfw_window, [](GLFWwindow* window, int count, const char** paths) { Testbed* testbed = (Testbed*)glfwGetWindowUserPointer(window); @@ -2977,8 +2976,18 @@ void Testbed::init_window(int resw, int resh, bool hidden, bool second_window) { IMGUI_CHECKVERSION(); ImGui::CreateContext(); ImGuiIO& io = ImGui::GetIO(); (void)io; - //io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls - io.ConfigInputTrickleEventQueue = false; // new ImGui event handling seems to make camera controls laggy if this is true. + + // By default, imgui places its configuration (state of the GUI -- size of windows, + // which regions are expanded, etc.) in ./imgui.ini relative to the working directory. + // Instead, we would like to place imgui.ini in the directory that instant-ngp project + // resides in. + static std::string ini_filename; + ini_filename = (get_root_dir()/"imgui.ini").str(); + io.IniFilename = ini_filename.c_str(); + + // New ImGui event handling seems to make camera controls laggy if input trickling is true. + // So disable input trickling. + io.ConfigInputTrickleEventQueue = false; ImGui::StyleColorsDark(); ImGui_ImplGlfw_InitForOpenGL(m_glfw_window, true); ImGui_ImplOpenGL3_Init("#version 140"); -- GitLab