Skip to content

Commit

Permalink
improve for mobile app
Browse files Browse the repository at this point in the history
  • Loading branch information
xianjimli committed Nov 7, 2024
1 parent ea0b7bd commit fa33cc6
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 42 deletions.
17 changes: 0 additions & 17 deletions 3rd/nanovg_plus/gl/nanovg_plus_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,6 @@
*
*/

#ifdef WITHOUT_GLAD
#include <SDL.h>

#ifdef IOS
#include <OpenGLES/gltypes.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengl.h>
#include <SDL_opengl_glext.h>
#endif /*IOS*/

#else
#include <glad/glad.h>
#endif /*WITHOUT_GLAD*/

#include "nanovg_plus_gl.h"

#ifdef NVGP_GL3
Expand Down
2 changes: 2 additions & 0 deletions 3rd/nanovg_plus/gl/nanovg_plus_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#ifdef __cplusplus
extern "C" {
#endif

#include "base/opengl.h"
#include "../base/nanovg_plus.h"

#ifndef NVGP_GL_INIT_CALL_NUMBER
Expand Down
17 changes: 0 additions & 17 deletions 3rd/nanovg_plus/gl/nanovg_plus_gl_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,6 @@
#ifndef __NANOVG_PLUS_GL_UTILS_H__
#define __NANOVG_PLUS_GL_UTILS_H__

#ifdef WITHOUT_GLAD
#include <SDL.h>

#ifdef IOS
#include <OpenGLES/gltypes.h>
#include <OpenGLES/ES2/gl.h>
#include <OpenGLES/ES2/glext.h>
#else
#define GL_GLEXT_PROTOTYPES 1
#include <SDL_opengl.h>
#include <SDL_opengl_glext.h>
#endif /*IOS*/

#else
#include <glad/glad.h>
#endif /*WITHOUT_GLAD*/

#include "nanovg_plus_gl.h"

typedef struct _nvgp_gl_util_framebuffer {
Expand Down
35 changes: 29 additions & 6 deletions scripts/awtk_mobile_common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ set(AWTK_COMMON_INCLUDES
${AWTK_SRC_PATH}
${AWTK_3RD_PATH}
${AWTK_3RD_PATH}/glad
${AWTK_3RD_PATH}/nanovg
${AWTK_3RD_PATH}/nanovg/gl
${AWTK_3RD_PATH}/nanovg/base
${AWTK_3RD_PATH}/gpinyin/include
${AWTK_3RD_PATH}/libunibreak
${AWTK_SRC_PATH}/ext_widgets
${AWTK_SRC_PATH}/custom_widgets)

set(AWTK_NANOVG_INCLUDES
${AWTK_3RD_PATH}/nanovg
${AWTK_3RD_PATH}/nanovg/gl
${AWTK_3RD_PATH}/nanovg/base
)

set(AWTK_NANOVG_PLUS_INCLUDES
${AWTK_3RD_PATH}/nanovg_plus
${AWTK_3RD_PATH}/nanovg_plus/gl
${AWTK_3RD_PATH}/nanovg_plus/base
)

set(AWTK_COMMON_FLAGS "${AWTK_COMMON_FLAGS} -DMOBILE_APP -DWITH_ASSET_LOADER ")
set(AWTK_COMMON_FLAGS "${AWTK_COMMON_FLAGS} -DWITH_STB_FONT -DWITHOUT_GLAD ")
Expand All @@ -27,10 +36,12 @@ set(AWTK_COMMON_FLAGS "${AWTK_COMMON_FLAGS} -DWITH_GPU_GL ")
set(AWTK_COMMON_FLAGS "${AWTK_COMMON_FLAGS} -DHAS_PTHREAD -DHAS_GET_TIME_US64=1 ")
set(AWTK_COMMON_FLAGS "${AWTK_COMMON_FLAGS} -DWITH_DATA_READER_WRITER=1 ")

set(AWTK_VGCANVAS_GLES2_FLAGS "-DWITH_GPU_GLES2 -DWITH_GPU_GL -DWITH_NANOVG_PLUS_GPU -DNVGP_GLES2 ")
set(AWTK_VGCANVAS_GLES3_FLAGS "-DWITH_GPU_GLES3 -DWITH_GPU_GL -DWITH_NANOVG_PLUS_GPU -DNVGP_GLES3 ")

file(GLOB AWTK_BASE_SOURCE_FILES
${AWTK_3RD_PATH}/libunibreak/*.c
${AWTK_3RD_PATH}/miniz/*.c
${AWTK_3RD_PATH}/nanovg/base/*.c
${AWTK_SRC_PATH}/tkc/*.c
${AWTK_SRC_PATH}/base/*.c
${AWTK_SRC_PATH}/layouters/*.c
Expand Down Expand Up @@ -66,18 +77,30 @@ file(GLOB AWTK_BASE_SOURCE_FILES
${AWTK_SRC_PATH}/fscript_ext/*.c
${AWTK_SRC_PATH}/charset/*.c
)

file(GLOB AWTK_VGCANVAS_NANOVG_SOURCE_FILES
${AWTK_3RD_PATH}/nanovg/base/*.c
${AWTK_SRC_PATH}/lcd/lcd_nanovg.c
${AWTK_SRC_PATH}/vgcanvas/vgcanvas_nanovg.c
${AWTK_SRC_PATH}/vgcanvas/vgcanvas_nanovg_gl.c
)

file(GLOB AWTK_VGCANVAS_NANOVG_PLUS_SOURCE_FILES
${AWTK_3RD_PATH}/nanovg_plus/base/*.c
${AWTK_3RD_PATH}/nanovg_plus/gl/*.c
${AWTK_SRC_PATH}/lcd/lcd_nanovg.c
${AWTK_SRC_PATH}/vgcanvas/vgcanvas_nanovg_plus.c
)

file(GLOB AWTK_COMMON_SOURCE_FILES
${AWTK_BASE_SOURCE_FILES}
${AWTK_SRC_PATH}/streams/inet/*.c
${AWTK_SRC_PATH}/streams/serial/*.c
${AWTK_SRC_PATH}/lcd/lcd_nanovg.c
${AWTK_SRC_PATH}/blend/*.c
${AWTK_SRC_PATH}/image_loader/*.c
${AWTK_SRC_PATH}/main_loop/main_loop_simple.c
${AWTK_SRC_PATH}/main_loop/main_loop_console.c
${AWTK_SRC_PATH}/input_engines/input_engine_pinyin.cpp
${AWTK_SRC_PATH}/vgcanvas/vgcanvas_nanovg_gl.c
${AWTK_SRC_PATH}/platforms/pc/*.c)

set(AWTK_SDL_COMMON_SOURCE_FILES
Expand Down
7 changes: 5 additions & 2 deletions src/base/opengl.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#ifndef AWTK_OPENGL_H
#define AWTK_OPENGL_H
#if defined(WITH_GPU_GL)

#ifdef WITHOUT_GLAD
Expand All @@ -24,14 +26,15 @@
#define opengl_loadGL() gladLoadGL()
#endif /*WITHOUT_GLAD*/

static ret_t opengl_init(void) {
static void opengl_init(void) {
opengl_loadGL();

glDisable(GL_STENCIL_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);

return RET_OK;
return;
}
#endif/*WITH_GPU_GL*/
#endif/*AWTK_OPENGL_H*/

0 comments on commit fa33cc6

Please sign in to comment.