Skip to content
Snippets Groups Projects
Commit 951cdb26 authored by Philip Trettner's avatar Philip Trettner
Browse files

Merge branch 'develop' into 'develop'

add sample for cache_window_size

See merge request !18
parents 7370a5e2 f105e5e8
No related branches found
No related tags found
1 merge request!18add sample for cache_window_size
Pipeline #24024 passed
glow-extras @ 89472844
Subproject commit db76c806b3df01907bab47d0c6f4cef17332156a Subproject commit 89472844133cbf2b352e5ecbf0f7cce037ac817d
...@@ -1174,6 +1174,34 @@ void headless_screenshot(pm::vertex_attribute<tg::pos3> const& pos) ...@@ -1174,6 +1174,34 @@ void headless_screenshot(pm::vertex_attribute<tg::pos3> const& pos)
gv::view(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) void special_use_cases(pm::vertex_attribute<tg::pos3> const& pos)
{ {
// TODO: decoupled camera // TODO: decoupled camera
...@@ -1397,6 +1425,8 @@ int main() ...@@ -1397,6 +1425,8 @@ int main()
headless_screenshot(pos); headless_screenshot(pos);
cache_window_size(pos);
imguizmo(pos); imguizmo(pos);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment