diff --git a/wpigui/src/main/native/cpp/wpigui.cpp b/wpigui/src/main/native/cpp/wpigui.cpp index 9ddbc46a70..cf77ee6240 100644 --- a/wpigui/src/main/native/cpp/wpigui.cpp +++ b/wpigui/src/main/native/cpp/wpigui.cpp @@ -34,7 +34,9 @@ static void WindowSizeCallback(GLFWwindow* window, int width, int height) { gContext->width = width; gContext->height = height; } - PlatformRenderFrame(); + if (!gContext->isPlatformRendering) { + PlatformRenderFrame(); + } } static void FramebufferSizeCallback(GLFWwindow* window, int width, int height) { @@ -291,7 +293,9 @@ void gui::Main() { while (!glfwWindowShouldClose(gContext->window) && !gContext->exit) { // Poll and handle events (inputs, window resize, etc.) glfwPollEvents(); + gContext->isPlatformRendering = true; PlatformRenderFrame(); + gContext->isPlatformRendering = false; // custom saving if (gContext->saveSettings) { diff --git a/wpigui/src/main/native/include/wpigui_internal.h b/wpigui/src/main/native/include/wpigui_internal.h index 48d983a225..4c8a22c866 100644 --- a/wpigui/src/main/native/include/wpigui_internal.h +++ b/wpigui/src/main/native/include/wpigui_internal.h @@ -37,6 +37,7 @@ struct Context : public SavedSettings { std::string title; int defaultWidth; int defaultHeight; + bool isPlatformRendering{false}; GLFWwindow* window = nullptr;