diff --git a/example/example_fbo.c b/example/example_fbo.c index 3e123b7..cff4ed2 100644 --- a/example/example_fbo.c +++ b/example/example_fbo.c @@ -175,7 +175,7 @@ int main() return -1; } - if (!loadFonts(vg) == -1) { + if (loadFonts(vg) == -1) { printf("Could not load fonts\n"); return -1; } diff --git a/src/nanovg_gl_utils.h b/src/nanovg_gl_utils.h index 9a33820..1323e90 100644 --- a/src/nanovg_gl_utils.h +++ b/src/nanovg_gl_utils.h @@ -64,7 +64,17 @@ NVGLUframebuffer* nvgluCreateFramebuffer(NVGcontext* ctx, int w, int h, int imag memset(fb, 0, sizeof(NVGLUframebuffer)); fb->image = nvgCreateImageRGBA(ctx, w, h, imageFlags | NVG_IMAGE_FLIPY | NVG_IMAGE_PREMULTIPLIED, NULL); - fb->texture = nvglImageHandle(ctx, fb->image); + +#if defined NANOVG_GL2 + fb->texture = nvglImageHandleGL2(ctx, fb->image); +#elif defined NANOVG_GL3 + fb->texture = nvglImageHandleGL3(ctx, fb->image); +#elif defined NANOVG_GLES2 + fb->texture = nvglImageHandleGLES2(ctx, fb->image); +#elif defined NANOVG_GLES3 + fb->texture = nvglImageHandleGLES3(ctx, fb->image); +#endif + fb->ctx = ctx; // frame buffer object