Always set VSync swap interval at startup, and only once at startup
This commit is contained in:
parent
ec7b3079a7
commit
bcc899bc78
1 changed files with 2 additions and 3 deletions
5
main.cpp
5
main.cpp
|
@ -126,8 +126,7 @@ int main(int, char**)
|
|||
SDL_SetWindowIcon(window, icon);
|
||||
SDL_GLContext gl_context = SDL_GL_CreateContext(window);
|
||||
SDL_GL_MakeCurrent(window, gl_context);
|
||||
SDL_GL_SetSwapInterval(0); // Enable vsync
|
||||
|
||||
|
||||
// Setup Dear ImGui context
|
||||
IMGUI_CHECKVERSION();
|
||||
ImGui::CreateContext();
|
||||
|
@ -216,7 +215,6 @@ int main(int, char**)
|
|||
}
|
||||
if (config.isMember("vsync")) {
|
||||
vsync = config["vsync"].asBool();
|
||||
SDL_GL_SetSwapInterval(vsync ? 1 : 0);
|
||||
}
|
||||
stream.close();
|
||||
}
|
||||
|
@ -233,6 +231,7 @@ int main(int, char**)
|
|||
}
|
||||
}
|
||||
}
|
||||
SDL_GL_SetSwapInterval(vsync ? 1 : 0);
|
||||
theme->Apply(accent_color);
|
||||
#ifdef __EMSCRIPTEN__
|
||||
// For an Emscripten build we are disabling file-system access, so let's not attempt to do a fopen() of the imgui.ini file.
|
||||
|
|
Loading…
Reference in a new issue