diff --git a/extern/glow-extras b/extern/glow-extras index db76c806b3df01907bab47d0c6f4cef17332156a..89472844133cbf2b352e5ecbf0f7cce037ac817d 160000 --- a/extern/glow-extras +++ b/extern/glow-extras @@ -1 +1 @@ -Subproject commit db76c806b3df01907bab47d0c6f4cef17332156a +Subproject commit 89472844133cbf2b352e5ecbf0f7cce037ac817d diff --git a/samples/basic/viewer/main.cc b/samples/basic/viewer/main.cc index f1cabf8498e27e33a93eabf320d352a37998c758..b6b42984688f71af19f7cbe24917d2e4385d127c 100644 --- a/samples/basic/viewer/main.cc +++ b/samples/basic/viewer/main.cc @@ -1174,6 +1174,34 @@ void headless_screenshot(pm::vertex_attribute<tg::pos3> const& pos) gv::view(pos); } +void cache_window_size(pm::vertex_attribute<tg::pos3> const& pos) +{ + // on closing the viewer, the window size and position are usually saved to and read from a + // glfwapp.ini file (and imgui.ini) in the current working directory + // + // this behavior can be changed using gv::cache_window_size(folder) or gv::no_cache_window_size + // -> gv::cache_window_size(folder) changes the folder for the .ini files + // - folder can be absolute (starting with "/") or relative to the CWD + // - the trailing "/" has no effect and is added automatically if it is not present + // - if the folder does not exist, a warning is emitted and the folder defaults to the CWD + // -> gv::no_cache_window_size disables creating or reading these files (same as gv::cache_window_size("")) + + { + // to avoid the creation of additional files, this is disabled in this sample file + // auto cfg = gv::config(gv::cache_window_size("/my_folder_path/")); + auto cfg = gv::config(gv::no_cache_window_size); + gv::view(pos, "this window does not read or write .ini files for the window size"); + } + + { + // interactive viewers currently depend on GV_SCOPED_CONFIG + GV_SCOPED_CONFIG(gv::no_cache_window_size); + gv::interactive([&](){ + gv::view(pos, "interactive version: this window does not read or write .ini files for the window size"); + }); + } +} + void special_use_cases(pm::vertex_attribute<tg::pos3> const& pos) { // TODO: decoupled camera @@ -1397,6 +1425,8 @@ int main() headless_screenshot(pos); + cache_window_size(pos); + imguizmo(pos); }