From 706efe908c11646e407722e60e7d191fbcfacd1e Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Tue, 3 Aug 2021 11:31:33 -0400 Subject: [PATCH] Use nvgCreateSharedGL2() to create framebuffer NanoVG context, so it shares fonts and images with the main context. --- dep/nanovg | 2 +- src/Window.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/dep/nanovg b/dep/nanovg index ade6e6c0..ccaaf90c 160000 --- a/dep/nanovg +++ b/dep/nanovg @@ -1 +1 @@ -Subproject commit ade6e6c060504002a4409fb0943432cf5c494872 +Subproject commit ccaaf90c80bb639823ff4cdcbbb413ee97751ebe diff --git a/src/Window.cpp b/src/Window.cpp index 639d7d98..506bcf0d 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -319,8 +319,7 @@ Window::Window() { int nvgFlags = NVG_ANTIALIAS; #if defined NANOVG_GL2 vg = nvgCreateGL2(nvgFlags); - // TODO Instead of creating a whole other NanoVG context, create one that uses the same fonts and framebuffers as `fb`. - fbVg = nvgCreateGL2(nvgFlags); + fbVg = nvgCreateSharedGL2(vg, nvgFlags); #elif defined NANOVG_GL3 vg = nvgCreateGL3(nvgFlags); #elif defined NANOVG_GLES2 @@ -331,8 +330,6 @@ Window::Window() { exit(1); } - // fbVg = nvgClone(vg); - // Load default Blendish font uiFont = loadFont(asset::system("res/fonts/DejaVuSans.ttf")); bndSetFont(uiFont->handle);