Browse Source

Use nvgCreateSharedGL2() to create framebuffer NanoVG context, so it shares fonts and images with the main context.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
706efe908c
2 changed files with 2 additions and 5 deletions
  1. +1
    -1
      dep/nanovg
  2. +1
    -4
      src/Window.cpp

+ 1
- 1
dep/nanovg

@@ -1 +1 @@
Subproject commit ade6e6c060504002a4409fb0943432cf5c494872
Subproject commit ccaaf90c80bb639823ff4cdcbbb413ee97751ebe

+ 1
- 4
src/Window.cpp View File

@@ -319,8 +319,7 @@ Window::Window() {
int nvgFlags = NVG_ANTIALIAS; int nvgFlags = NVG_ANTIALIAS;
#if defined NANOVG_GL2 #if defined NANOVG_GL2
vg = nvgCreateGL2(nvgFlags); 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 #elif defined NANOVG_GL3
vg = nvgCreateGL3(nvgFlags); vg = nvgCreateGL3(nvgFlags);
#elif defined NANOVG_GLES2 #elif defined NANOVG_GLES2
@@ -331,8 +330,6 @@ Window::Window() {
exit(1); exit(1);
} }


// fbVg = nvgClone(vg);

// Load default Blendish font // Load default Blendish font
uiFont = loadFont(asset::system("res/fonts/DejaVuSans.ttf")); uiFont = loadFont(asset::system("res/fonts/DejaVuSans.ttf"));
bndSetFont(uiFont->handle); bndSetFont(uiFont->handle);


Loading…
Cancel
Save