From 3eeafc1a14d5031e92a24227e5ea6a6be747e894 Mon Sep 17 00:00:00 2001 From: Andrew Corrigan Date: Sat, 21 Feb 2015 10:15:13 -0500 Subject: [PATCH] Fix for issue #172 --- src/nanovg_gl.h | 36 ++++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/src/nanovg_gl.h b/src/nanovg_gl.h index 5235795..cb2c3c1 100644 --- a/src/nanovg_gl.h +++ b/src/nanovg_gl.h @@ -59,6 +59,9 @@ enum NVGcreateFlags { NVGcontext* nvgCreateGL2(int flags); void nvgDeleteGL2(NVGcontext* ctx); +int nvglCreateImageFromHandleGL2(NVGcontext* ctx, GLuint textureId, int w, int h, int flags); +GLuint nvglImageFromHandleGL2(NVGcontext* ctx, int image); + #endif #if defined NANOVG_GL3 @@ -66,6 +69,9 @@ void nvgDeleteGL2(NVGcontext* ctx); NVGcontext* nvgCreateGL3(int flags); void nvgDeleteGL3(NVGcontext* ctx); +int nvglCreateImageFromHandleGL3(NVGcontext* ctx, GLuint textureId, int w, int h, int flags); +GLuint nvglImageHandleGL3(NVGcontext* ctx, int image); + #endif #if defined NANOVG_GLES2 @@ -73,6 +79,9 @@ void nvgDeleteGL3(NVGcontext* ctx); NVGcontext* nvgCreateGLES2(int flags); void nvgDeleteGLES2(NVGcontext* ctx); +int nvglCreateImageFromHandleGLES2(NVGcontext* ctx, GLuint textureId, int w, int h, int flags); +GLuint nvglImageHandleGLES2(NVGcontext* ctx, int image); + #endif #if defined NANOVG_GLES3 @@ -80,6 +89,9 @@ void nvgDeleteGLES2(NVGcontext* ctx); NVGcontext* nvgCreateGLES3(int flags); void nvgDeleteGLES3(NVGcontext* ctx); +int nvglCreateImageFromHandleGLES3(NVGcontext* ctx, GLuint textureId, int w, int h, int flags); +GLuint nvglImageHandleGLES3(NVGcontext* ctx, int image); + #endif // These are additional flags on top of NVGimageFlags. @@ -87,10 +99,6 @@ enum NVGimageFlagsGL { NVG_IMAGE_NODELETE = 1<<16, // Do not delete GL texture handle. }; -int nvglCreateImageFromHandle(NVGcontext* ctx, GLuint textureId, int w, int h, int flags); -GLuint nvglImageHandle(NVGcontext* ctx, int image); - - #ifdef __cplusplus } #endif @@ -1499,7 +1507,15 @@ void nvgDeleteGLES3(NVGcontext* ctx) nvgDeleteInternal(ctx); } -int nvglCreateImageFromHandle(NVGcontext* ctx, GLuint textureId, int w, int h, int imageFlags) +#if defined NANOVG_GL2 +int nvglCreateImageFromHandleGL2(NVGcontext* ctx, GLuint textureId, int w, int h, int imageFlags) +#elif defined NANOVG_GL3 +int nvglCreateImageFromHandleGL3(NVGcontext* ctx, GLuint textureId, int w, int h, int imageFlags) +#elif defined NANOVG_GLES2 +int nvglCreateImageFromHandleGLES2(NVGcontext* ctx, GLuint textureId, int w, int h, int imageFlags) +#elif defined NANOVG_GLES3 +int nvglCreateImageFromHandleGLES3(NVGcontext* ctx, GLuint textureId, int w, int h, int imageFlags) +#endif { GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(ctx)->userPtr; GLNVGtexture* tex = glnvg__allocTexture(gl); @@ -1515,7 +1531,15 @@ int nvglCreateImageFromHandle(NVGcontext* ctx, GLuint textureId, int w, int h, i return tex->id; } -GLuint nvglImageHandle(NVGcontext* ctx, int image) +#if defined NANOVG_GL2 +GLuint nvglImageHandleGL2(NVGcontext* ctx, int image) +#elif defined NANOVG_GL3 +GLuint nvglImageHandleGL3(NVGcontext* ctx, int image) +#elif defined NANOVG_GLES2 +GLuint nvglImageHandleGLES2(NVGcontext* ctx, int image) +#elif defined NANOVG_GLES3 +GLuint nvglImageHandleGLES3(NVGcontext* ctx, int image) +#endif { GLNVGcontext* gl = (GLNVGcontext*)nvgInternalParams(ctx)->userPtr; GLNVGtexture* tex = glnvg__findTexture(gl, image);