@@ -744,7 +744,7 @@ int main() | |||||
glfwMakeContextCurrent(window); | glfwMakeContextCurrent(window); | ||||
vg = glnvgCreate(); | |||||
vg = glnvgCreate(512,512); | |||||
if (vg == NULL) { | if (vg == NULL) { | ||||
printf("Could not init nanovg.\n"); | printf("Could not init nanovg.\n"); | ||||
return -1; | return -1; | ||||
@@ -633,7 +633,7 @@ static void glnvg__renderDelete(void* uptr) | |||||
} | } | ||||
struct NVGcontext* glnvgCreate() | |||||
struct NVGcontext* glnvgCreate(int atlasw, int atlash) | |||||
{ | { | ||||
struct NVGparams params; | struct NVGparams params; | ||||
struct NVGcontext* ctx = NULL; | struct NVGcontext* ctx = NULL; | ||||
@@ -652,6 +652,8 @@ struct NVGcontext* glnvgCreate() | |||||
params.renderTriangles = glnvg__renderTriangles; | params.renderTriangles = glnvg__renderTriangles; | ||||
params.renderDelete = glnvg__renderDelete; | params.renderDelete = glnvg__renderDelete; | ||||
params.userPtr = gl; | params.userPtr = gl; | ||||
params.atlasWidth = atlasw; | |||||
params.atlasHeight = atlash; | |||||
ctx = nvgCreateInternal(¶ms); | ctx = nvgCreateInternal(¶ms); | ||||
if (ctx == NULL) goto error; | if (ctx == NULL) goto error; | ||||
@@ -201,8 +201,8 @@ struct NVGcontext* nvgCreateInternal(struct NVGparams* params) | |||||
// Init font rendering | // Init font rendering | ||||
memset(&fontParams, 0, sizeof(fontParams)); | memset(&fontParams, 0, sizeof(fontParams)); | ||||
fontParams.width = 512; | |||||
fontParams.height = 512; | |||||
fontParams.width = params->atlasWidth; | |||||
fontParams.height = params->atlasHeight; | |||||
fontParams.flags = FONS_ZERO_TOPLEFT; | fontParams.flags = FONS_ZERO_TOPLEFT; | ||||
fontParams.renderCreate = NULL; | fontParams.renderCreate = NULL; | ||||
fontParams.renderUpdate = NULL; | fontParams.renderUpdate = NULL; | ||||
@@ -90,6 +90,7 @@ struct NVGpath { | |||||
struct NVGparams { | struct NVGparams { | ||||
void* userPtr; | void* userPtr; | ||||
int atlasWidth, atlasHeight; | |||||
int (*renderCreate)(void* uptr); | int (*renderCreate)(void* uptr); | ||||
int (*renderCreateTexture)(void* uptr, int type, int w, int h, const unsigned char* data); | int (*renderCreateTexture)(void* uptr, int type, int w, int h, const unsigned char* data); | ||||
int (*renderDeleteTexture)(void* uptr, int image); | int (*renderDeleteTexture)(void* uptr, int image); | ||||