diff --git a/src/window.cpp b/src/window.cpp index a2b9206c..464956e5 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -301,6 +301,10 @@ void Window::run() { while(!glfwWindowShouldClose(win)) { frameTimeStart = glfwGetTime(); + // Make event handlers and step() have a clean nanovg context + nvgReset(vg); + bndSetFont(uiFont->handle); + // Poll events glfwPollEvents(); // In case glfwPollEvents() set another OpenGL context @@ -329,8 +333,6 @@ void Window::run() { internal->lastWindowTitle = windowTitle; } - bndSetFont(uiFont->handle); - // Get desired scaling float pixelRatio; glfwGetWindowContentScale(win, &pixelRatio, NULL); @@ -359,7 +361,6 @@ void Window::run() { if (visible) { // Update and render nvgBeginFrame(vg, fbWidth, fbHeight, pixelRatio); - nvgReset(vg); nvgScale(vg, pixelRatio, pixelRatio); // Draw scene