nanovg support gl2

This commit is contained in:
lixianjing 2024-04-13 12:18:52 +08:00
parent 608b443a92
commit bd344d8cb2
4 changed files with 18 additions and 2 deletions

View File

@ -55,6 +55,7 @@ else:
# NANOVG_BACKEND='AGG'
# NANOVG_BACKEND='BGFX'
# NANOVG_BACKEND='AGGE'
# NANOVG_BACKEND='GL2'
NANOVG_BACKEND = complie_helper.get_value('NANOVG_BACKEND', NANOVG_BACKEND)
FRAME_BUFFER_FORMAT = ''
@ -200,6 +201,10 @@ else:
NANOVG_BACKEND_LIBS = ['nanovg']
COMMON_CCFLAGS = COMMON_CCFLAGS + \
' -DWITH_NANOVG_GLES3 -DWITH_NANOVG_GL -DWITH_NANOVG_GPU '
elif NANOVG_BACKEND == 'GL2':
NANOVG_BACKEND_LIBS = ['nanovg']
COMMON_CCFLAGS = COMMON_CCFLAGS + \
' -DWITH_NANOVG_GL2 -DWITH_NANOVG_GL -DWITH_NANOVG_GPU '
else:
NANOVG_BACKEND_LIBS = ['nanovg']
COMMON_CCFLAGS = COMMON_CCFLAGS + \

View File

@ -1,5 +1,8 @@
# 最新动态
2024/04/13
* nanovg 支持 GL2。
2024/04/12
* 完善text\_edit增加原生输入法跟随光标移动功能(感谢颖健提供补丁)

View File

@ -29,6 +29,10 @@
#define NANOVG_GL3_IMPLEMENTATION
#endif
#if defined(WITH_NANOVG_GL2)
#define NANOVG_GL2_IMPLEMENTATION
#endif
#if defined(WITH_NANOVG_GLES2)
#define NANOVG_GLES2_IMPLEMENTATION
#endif
@ -128,7 +132,9 @@ vgcanvas_t* vgcanvas_create(uint32_t w, uint32_t h, uint32_t stride, bitmap_form
vgcanvas_nanovg_init((vgcanvas_t*)nanovg);
#if defined(WITH_NANOVG_GL3)
#if defined(WITH_NANOVG_GL2)
nanovg->vg = nvgCreateGL2(NVG_ANTIALIAS | NVG_STENCIL_STROKES);
#elif defined(WITH_NANOVG_GL3)
nanovg->vg = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES);
#elif defined(WITH_NANOVG_GLES2)
nanovg->vg = nvgCreateGLES2(NVG_ANTIALIAS | NVG_STENCIL_STROKES);

View File

@ -226,7 +226,9 @@ static ret_t vgcanvas_nanovg_destroy(vgcanvas_t* vgcanvas) {
vgcanvas_asset_manager_remove_vg(vgcanvas_asset_manager(), vgcanvas);
vgcanvas_nanovg_deinit(vgcanvas);
#if defined(WITH_NANOVG_GL3)
#if defined(WITH_NANOVG_GL2)
nvgDeleteGL2(vg);
#elif defined(WITH_NANOVG_GL3)
nvgDeleteGL3(vg);
#elif defined(WITH_NANOVG_GLES2)
nvgDeleteGLES2(vg);