improve for mobile app

This commit is contained in:
lixianjing 2024-11-07 18:29:07 +08:00
parent ea0b7bdc6c
commit fa33cc6b5b
5 changed files with 36 additions and 42 deletions

View File

@ -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

View File

@ -25,6 +25,8 @@
#ifdef __cplusplus
extern "C" {
#endif
#include "base/opengl.h"
#include "../base/nanovg_plus.h"
#ifndef NVGP_GL_INIT_CALL_NUMBER

View File

@ -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 {

View File

@ -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 ")
@ -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
@ -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

View File

@ -1,3 +1,5 @@
#ifndef AWTK_OPENGL_H
#define AWTK_OPENGL_H
#if defined(WITH_GPU_GL)
#ifdef WITHOUT_GLAD
@ -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*/