From ea47c91571a8dfe07162220dfed413b0a14c0074 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 12 Oct 2017 19:42:52 -0400 Subject: [PATCH] Render nanovg gui even if minimized --- src/gui.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/gui.cpp b/src/gui.cpp index 9e4b7050..cff2b052 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -217,24 +217,20 @@ void renderGui() { glfwGetWindowSize(gWindow, &windowWidth, &windowHeight); gPixelRatio = (float)width / windowWidth; + // Update and render + glViewport(0, 0, width, height); + glClearColor(0.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); + nvgBeginFrame(gVg, width, height, gPixelRatio); + bool visible = glfwGetWindowAttrib(gWindow, GLFW_VISIBLE) && !glfwGetWindowAttrib(gWindow, GLFW_ICONIFIED); if (visible) { - // Update and render - glViewport(0, 0, width, height); - glClearColor(0.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); - - nvgBeginFrame(gVg, width, height, gPixelRatio); - - nvgSave(gVg); nvgReset(gVg); nvgScale(gVg, gPixelRatio, gPixelRatio); gScene->draw(gVg); - nvgRestore(gVg); - - nvgEndFrame(gVg); } + nvgEndFrame(gVg); glfwSwapBuffers(gWindow); }