OpenGL ES 1.0 refresher (GLES1 for friends)

Variant of GL1, meant for embedded/mobile devices only.
Build it with "make with_gles1".
For Windows, you'll need MSYS2 and a decent ANGLE implementation
(probably not worth the trouble).
Building with CMake only works in Linux, so it has been commented out.
This commit is contained in:
Jaime Moreira 2024-07-27 23:15:12 -04:00
parent 94c4bf2df7
commit 03227f1ed6
14 changed files with 2372 additions and 25 deletions

View file

@ -601,6 +601,8 @@ set(GL1-Source
${COMMON_SRC_DIR}/md4.c ${COMMON_SRC_DIR}/md4.c
) )
set(Glad-GLES1-Source ${REF_SRC_DIR}/gl1/glad-gles1/src/glad.c)
set(GL1-Header set(GL1-Header
${REF_SRC_DIR}/ref_shared.h ${REF_SRC_DIR}/ref_shared.h
${REF_SRC_DIR}/constants/anorms.h ${REF_SRC_DIR}/constants/anorms.h
@ -614,6 +616,11 @@ set(GL1-Header
${COMMON_SRC_DIR}/header/shared.h ${COMMON_SRC_DIR}/header/shared.h
) )
set(Glad-GLES1-Header
${REF_SRC_DIR}/gl1/glad-gles1/include/glad/glad.h
${REF_SRC_DIR}/gl1/glad-gles1/include/KHR/khrplatform.h
)
set(GL3-Source set(GL3-Source
${REF_SRC_DIR}/gl3/gl3_draw.c ${REF_SRC_DIR}/gl3/gl3_draw.c
${REF_SRC_DIR}/gl3/gl3_image.c ${REF_SRC_DIR}/gl3/gl3_image.c
@ -829,3 +836,24 @@ target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
if(SDL3_SUPPORT) if(SDL3_SUPPORT)
target_link_libraries(ref_soft SDL3::SDL3) target_link_libraries(ref_soft SDL3::SDL3)
endif() endif()
if(FALSE)
# Build the GLES1 dynamic library
add_library(ref_gles1 MODULE ${GL1-Source} ${Glad-GLES1-Source} ${GL1-Header} ${Glad-GLES1-Header} ${REF-Platform-Specific-Source})
set_target_properties(ref_gles1 PROPERTIES
PREFIX ""
#COMPILE_DEFINITIONS "YQ2_GL1_GLES=1"
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/release
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
)
target_include_directories(ref_gles1 PRIVATE ${CMAKE_SOURCE_DIR}/src/client/refresh/gl1/glad-gles1/include)
target_compile_definitions(ref_gles1 PRIVATE YQ2_GL1_GLES=1)
target_link_libraries(ref_gles1 ${yquake2LinkerFlags} ${yquake2OpenGLLinkerFlags}
${yquake2SDLLinkerFlags})
if(SDL3_SUPPORT)
target_link_libraries(ref_gles1 SDL3::SDL3)
endif()
endif()

View file

@ -397,15 +397,20 @@ endif
# ---------- # ----------
# Phony targets # Phony targets
.PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles3 ref_soft .PHONY : all client game icon server ref_gl1 ref_gl3 ref_gles1 ref_gles3 ref_soft
# ---------- # ----------
# Builds everything # Builds everything but the GLES1 renderer
all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft all: config client server game ref_gl1 ref_gl3 ref_gles3 ref_soft
# ---------- # ----------
# Builds everything, including the GLES1 renderer
with_gles1: all ref_gles1
# ----------
# Print config values # Print config values
config: config:
@echo "Build configuration" @echo "Build configuration"
@ -622,6 +627,49 @@ build/ref_gl1/%.o: %.c
# ---------- # ----------
# The OpenGL ES 1.0 renderer lib
ifeq ($(YQ2_OSTYPE), Windows)
ref_gles1:
@echo "===> Building ref_gles1.dll"
$(MAKE) release/ref_gles1.dll
release/ref_gles1.dll : GLAD_INCLUDE = -Isrc/client/refresh/gl1/glad-gles1/include
release/ref_gles1.dll : CFLAGS += -DYQ2_GL1_GLES
release/ref_gles1.dll : LDFLAGS += -shared
release/ref_gles1.dll : LDLIBS += -lGLESv2
else ifeq ($(YQ2_OSTYPE), Darwin)
ref_gles1:
@echo "===> Building ref_gles1.dylib"
$(MAKE) release/ref_gles1.dylib
release/ref_gles1.dylib : GLAD_INCLUDE = -Isrc/client/refresh/gl1/glad-gles1/include
release/ref_gles1.dylib : CFLAGS += -DYQ2_GL1_GLES
release/ref_gles1.dylib : LDFLAGS += -shared -framework OpenGL
else # not Windows or Darwin
ref_gles1:
@echo "===> Building ref_gles1.so"
$(MAKE) release/ref_gles1.so
release/ref_gles1.so : GLAD_INCLUDE = -Isrc/client/refresh/gl1/glad-gles1/include
release/ref_gles1.so : CFLAGS += -DYQ2_GL1_GLES -fPIC
release/ref_gles1.so : LDFLAGS += -shared
release/ref_gles1.so : LDLIBS += -lGL
endif # OS specific ref_gles1 stuff
build/ref_gles1/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) $(GLAD_INCLUDE) -o $@ $<
# ----------
# The OpenGL 3.x renderer lib # The OpenGL 3.x renderer lib
ifeq ($(YQ2_OSTYPE), Windows) ifeq ($(YQ2_OSTYPE), Windows)
@ -969,6 +1017,9 @@ REFGL1_OBJS_ := \
src/common/shared/shared.o \ src/common/shared/shared.o \
src/common/md4.o src/common/md4.o
REFGL1_OBJS_GLADEES_ := \
src/client/refresh/gl1/glad-gles1/src/glad.o
ifeq ($(YQ2_OSTYPE), Windows) ifeq ($(YQ2_OSTYPE), Windows)
REFGL1_OBJS_ += \ REFGL1_OBJS_ += \
src/backends/windows/shared/hunk.o src/backends/windows/shared/hunk.o
@ -1110,6 +1161,8 @@ endif
# Rewrite paths to our object directory. # Rewrite paths to our object directory.
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_)) CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
REFGL1_OBJS = $(patsubst %,build/ref_gl1/%,$(REFGL1_OBJS_)) REFGL1_OBJS = $(patsubst %,build/ref_gl1/%,$(REFGL1_OBJS_))
REFGLES1_OBJS = $(patsubst %,build/ref_gles1/%,$(REFGL1_OBJS_))
REFGLES1_OBJS += $(patsubst %,build/ref_gles1/%,$(REFGL1_OBJS_GLADEES_))
REFGL3_OBJS = $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_)) REFGL3_OBJS = $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_))
REFGL3_OBJS += $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_GLADE_)) REFGL3_OBJS += $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_GLADE_))
REFGLES3_OBJS = $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_)) REFGLES3_OBJS = $(patsubst %,build/ref_gles3/%,$(REFGL3_OBJS_))
@ -1124,6 +1177,7 @@ GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d) CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
GAME_DEPS= $(GAME_OBJS:.o=.d) GAME_DEPS= $(GAME_OBJS:.o=.d)
REFGL1_DEPS= $(REFGL1_OBJS:.o=.d) REFGL1_DEPS= $(REFGL1_OBJS:.o=.d)
REFGLES1_DEPS= $(REFGLES1_OBJS:.o=.d)
REFGL3_DEPS= $(REFGL3_OBJS:.o=.d) REFGL3_DEPS= $(REFGL3_OBJS:.o=.d)
REFGLES3_DEPS= $(REFGLES3_OBJS:.o=.d) REFGLES3_DEPS= $(REFGLES3_OBJS:.o=.d)
REFSOFT_DEPS= $(REFSOFT_OBJS:.o=.d) REFSOFT_DEPS= $(REFSOFT_OBJS:.o=.d)
@ -1133,6 +1187,7 @@ SERVER_DEPS= $(SERVER_OBJS:.o=.d)
-include $(CLIENT_DEPS) -include $(CLIENT_DEPS)
-include $(GAME_DEPS) -include $(GAME_DEPS)
-include $(REFGL1_DEPS) -include $(REFGL1_DEPS)
-include $(REFGLES1_DEPS)
-include $(REFGL3_DEPS) -include $(REFGL3_DEPS)
-include $(REFGLES3_DEPS) -include $(REFGLES3_DEPS)
-include $(SERVER_DEPS) -include $(SERVER_DEPS)
@ -1182,6 +1237,22 @@ release/ref_gl1.so : $(REFGL1_OBJS)
${Q}$(CC) $(LDFLAGS) $(REFGL1_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@ ${Q}$(CC) $(LDFLAGS) $(REFGL1_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
endif endif
# release/ref_gles1.so
ifeq ($(YQ2_OSTYPE), Windows)
release/ref_gles1.dll : $(REFGLES1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFGLES1_OBJS) $(LDLIBS) $(DLL_SDLLDFLAGS) -o $@
$(Q)strip $@
else ifeq ($(YQ2_OSTYPE), Darwin)
release/ref_gles1.dylib : $(REFGLES1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFGLES1_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
else
release/ref_gles1.so : $(REFGLES1_OBJS)
@echo "===> LD $@"
${Q}$(CC) $(LDFLAGS) $(REFGLES1_OBJS) $(LDLIBS) $(SDLLDFLAGS) -o $@
endif
# release/ref_gl3.so # release/ref_gl3.so
ifeq ($(YQ2_OSTYPE), Windows) ifeq ($(YQ2_OSTYPE), Windows)
release/ref_gl3.dll : $(REFGL3_OBJS) release/ref_gl3.dll : $(REFGL3_OBJS)

View file

@ -322,6 +322,10 @@ or *gmake* (FreeBSD, NetBSD, OpenBSD). Note on Solaris systems, *make*
After the build finished, copy everything from the *release/* directory After the build finished, copy everything from the *release/* directory
to the Yamagi Quake II installation directory. to the Yamagi Quake II installation directory.
If you want to generate the OpenGL ES 1.0 renderer, which may be the only
graphics API available on some SoCs (like Raspberry Pi 3 or older), type
*make with_gles1*.
For the addons download or clone their source, change into the source For the addons download or clone their source, change into the source
directory and type *make* (Linux, MacOS and Windows) or *gmake* directory and type *make* (Linux, MacOS and Windows) or *gmake*
(FreeBSD, NetBSD, OpenBSD). After the compilation finishes the *release/game.so* (FreeBSD, NetBSD, OpenBSD). After the compilation finishes the *release/game.so*

View file

@ -8,7 +8,7 @@ have been renamed. The prefixes are:
* No prefix: General stuff. * No prefix: General stuff.
* `cl_`: Client. * `cl_`: Client.
* `gl_`: Common to all OpenGL renderers. * `gl_`: Common to all OpenGL renderers.
* `gl1_`: OpenGL 1.4 renderer. * `gl1_`: OpenGL 1.4 and OpenGL ES1 renderers.
* `gl3_`: OpenGL 3.2 and OpenGL ES3 renderers. * `gl3_`: OpenGL 3.2 and OpenGL ES3 renderers.
* `ogg_`: Ogg/Vorbis music playback. * `ogg_`: Ogg/Vorbis music playback.
* `r_`: Common to all renderers. * `r_`: Common to all renderers.
@ -469,7 +469,7 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable`
`GL_NEAREST_MIPMAP_LINEAR`, `GL_LINEAR_MIPMAP_LINEAR` `GL_NEAREST_MIPMAP_LINEAR`, `GL_LINEAR_MIPMAP_LINEAR`
## Graphics (OpenGL 1.4 only) ## Graphics (OpenGL 1.4 and OpenGL ES1 only)
* **gl1_intensity**: Sets the color intensity. Must be a floating point * **gl1_intensity**: Sets the color intensity. Must be a floating point
value, at least `1.0` - default is `2.0`. Applied when textures are value, at least `1.0` - default is `2.0`. Applied when textures are

View file

@ -72,8 +72,8 @@ static menuaction_s s_apply_action;
// -------- // --------
// gl1, gl3, gles3, gl4, vk, soft // gl1, gl3, gles1, gles3, gl4, vk, soft
#define MAXRENDERERS 6 #define MAXRENDERERS 7
typedef struct typedef struct
{ {
@ -96,6 +96,13 @@ Renderer_FillRenderdef(void)
rendererlist[numrenderer].cvarstr = "gl1"; rendererlist[numrenderer].cvarstr = "gl1";
} }
if (VID_HasRenderer("gles1"))
{
numrenderer++;
rendererlist[numrenderer].boxstr = "[OpenGL ES1]";
rendererlist[numrenderer].cvarstr = "gles1";
}
if (VID_HasRenderer("gl3")) if (VID_HasRenderer("gl3"))
{ {
numrenderer++; numrenderer++;
@ -188,7 +195,7 @@ static void
ApplyFilter(void* unused) ApplyFilter(void* unused)
{ {
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 || if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
Q_stricmp(vid_renderer->string, "gl1") == 0) Q_stricmp(vid_renderer->string, "gl1") == 0 || Q_stricmp(vid_renderer->string, "gles1") == 0)
{ {
if (s_filter_list.curvalue == 0) if (s_filter_list.curvalue == 0)
{ {
@ -715,7 +722,7 @@ VID_MenuInit(void)
int mode = 0; int mode = 0;
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 || if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
Q_stricmp(vid_renderer->string, "gl1") == 0) Q_stricmp(vid_renderer->string, "gl1") == 0 || Q_stricmp(vid_renderer->string, "gles1") == 0)
{ {
s_filter_list.generic.x = 0; s_filter_list.generic.x = 0;
s_filter_list.generic.y = (y += 10); s_filter_list.generic.y = (y += 10);
@ -789,7 +796,7 @@ VID_MenuInit(void)
Menu_AddItem(&s_opengl_menu, (void *)&s_vk_overbrightbits_slider); Menu_AddItem(&s_opengl_menu, (void *)&s_vk_overbrightbits_slider);
Menu_AddItem(&s_opengl_menu, (void *)&s_vk_dynamic_list); Menu_AddItem(&s_opengl_menu, (void *)&s_vk_dynamic_list);
} }
else if (strcmp(vid_renderer->string, "gl1") == 0) else if (strcmp(vid_renderer->string, "gl1") == 0 || strcmp(vid_renderer->string, "gles1") == 0)
{ {
Menu_AddItem(&s_opengl_menu, (void *)&s_gl1_intensity_slider); Menu_AddItem(&s_opengl_menu, (void *)&s_gl1_intensity_slider);
Menu_AddItem(&s_opengl_menu, (void *)&s_gl1_overbrightbits_slider); Menu_AddItem(&s_opengl_menu, (void *)&s_gl1_overbrightbits_slider);
@ -800,7 +807,8 @@ VID_MenuInit(void)
Menu_AddItem(&s_opengl_menu, (void *)&s_af_list); Menu_AddItem(&s_opengl_menu, (void *)&s_af_list);
Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list); Menu_AddItem(&s_opengl_menu, (void *)&s_msaa_list);
if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 || if (Q_stricmp(vid_renderer->string, "gl3") == 0 || Q_stricmp(vid_renderer->string, "gles3") == 0 ||
Q_stricmp(vid_renderer->string, "gl1") == 0 || Q_stricmp(vid_renderer->string, "soft") == 0) Q_stricmp(vid_renderer->string, "gl1") == 0 || Q_stricmp(vid_renderer->string, "gles1") == 0 ||
Q_stricmp(vid_renderer->string, "soft") == 0)
{ {
Menu_AddItem(&s_opengl_menu, (void *)&s_filter_list); Menu_AddItem(&s_opengl_menu, (void *)&s_filter_list);
} }

View file

@ -47,9 +47,17 @@ qboolean R_Upload32(unsigned *data, int width, int height, qboolean mipmap);
int gl_solid_format = GL_RGB; int gl_solid_format = GL_RGB;
int gl_alpha_format = GL_RGBA; int gl_alpha_format = GL_RGBA;
int gl_tex_solid_format = GL_RGB; #ifdef YQ2_GL1_GLES
#define DEFAULT_SOLID_FORMAT GL_RGBA
#else
#define DEFAULT_SOLID_FORMAT GL_RGB
#endif
int gl_tex_solid_format = DEFAULT_SOLID_FORMAT;
int gl_tex_alpha_format = GL_RGBA; int gl_tex_alpha_format = GL_RGBA;
#undef DEFAULT_SOLID_FORMAT
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST; int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR; int gl_filter_max = GL_LINEAR;
@ -76,6 +84,20 @@ typedef struct
int mode; int mode;
} gltmode_t; } gltmode_t;
#ifdef YQ2_GL1_GLES
gltmode_t gl_alpha_modes[] = {
{"default", GL_RGBA},
{"GL_RGBA", GL_RGBA},
};
gltmode_t gl_solid_modes[] = {
{"default", GL_RGBA},
{"GL_RGBA", GL_RGBA},
};
#else
gltmode_t gl_alpha_modes[] = { gltmode_t gl_alpha_modes[] = {
{"default", GL_RGBA}, {"default", GL_RGBA},
{"GL_RGBA", GL_RGBA}, {"GL_RGBA", GL_RGBA},
@ -85,8 +107,6 @@ gltmode_t gl_alpha_modes[] = {
{"GL_RGBA2", GL_RGBA2}, {"GL_RGBA2", GL_RGBA2},
}; };
#define NUM_GL_ALPHA_MODES (sizeof(gl_alpha_modes) / sizeof(gltmode_t))
gltmode_t gl_solid_modes[] = { gltmode_t gl_solid_modes[] = {
{"default", GL_RGB}, {"default", GL_RGB},
{"GL_RGB", GL_RGB}, {"GL_RGB", GL_RGB},
@ -96,6 +116,9 @@ gltmode_t gl_solid_modes[] = {
{"GL_R3_G3_B2", GL_R3_G3_B2}, {"GL_R3_G3_B2", GL_R3_G3_B2},
}; };
#endif
#define NUM_GL_ALPHA_MODES (sizeof(gl_alpha_modes) / sizeof(gltmode_t))
#define NUM_GL_SOLID_MODES (sizeof(gl_solid_modes) / sizeof(gltmode_t)) #define NUM_GL_SOLID_MODES (sizeof(gl_solid_modes) / sizeof(gltmode_t))
typedef struct typedef struct

View file

@ -925,6 +925,7 @@ R_SetGL2D(void)
static void static void
R_RenderView(refdef_t *fd) R_RenderView(refdef_t *fd)
{ {
#ifndef YQ2_GL1_GLES
if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) { if ((gl_state.stereo_mode != STEREO_MODE_NONE) && gl_state.camera_separation) {
qboolean drawing_left_eye = gl_state.camera_separation < 0; qboolean drawing_left_eye = gl_state.camera_separation < 0;
@ -1032,7 +1033,7 @@ R_RenderView(refdef_t *fd)
break; break;
} }
} }
#endif
if (r_norefresh->value) if (r_norefresh->value)
{ {
@ -1400,6 +1401,13 @@ R_SetMode(void)
return true; return true;
} }
// just to avoid too many preprocessor directives in RI_Init()
typedef enum
{
rf_opengl14,
rf_opengles10
} refresher_t;
qboolean qboolean
RI_Init(void) RI_Init(void)
{ {
@ -1407,6 +1415,14 @@ RI_Init(void)
byte *colormap; byte *colormap;
extern float r_turbsin[256]; extern float r_turbsin[256];
#ifdef YQ2_GL1_GLES
#define GLEXTENSION_NPOT "GL_OES_texture_npot"
static const refresher_t refresher = rf_opengles10;
#else
#define GLEXTENSION_NPOT "GL_ARB_texture_non_power_of_two"
static const refresher_t refresher = rf_opengl14;
#endif
Swap_Init(); Swap_Init();
for (j = 0; j < 256; j++) for (j = 0; j < 256; j++)
@ -1462,7 +1478,7 @@ RI_Init(void)
sscanf(gl_config.version_string, "%d.%d", &gl_config.major_version, &gl_config.minor_version); sscanf(gl_config.version_string, "%d.%d", &gl_config.major_version, &gl_config.minor_version);
if (gl_config.major_version == 1) if (refresher == rf_opengl14 && gl_config.major_version == 1)
{ {
if (gl_config.minor_version < 4) if (gl_config.minor_version < 4)
{ {
@ -1480,7 +1496,8 @@ RI_Init(void)
/* Point parameters */ /* Point parameters */
R_Printf(PRINT_ALL, " - Point parameters: "); R_Printf(PRINT_ALL, " - Point parameters: ");
if ( strstr(gl_config.extensions_string, "GL_ARB_point_parameters") || if ( refresher == rf_opengles10 ||
strstr(gl_config.extensions_string, "GL_ARB_point_parameters") ||
strstr(gl_config.extensions_string, "GL_EXT_point_parameters") ) // should exist for all OGL 1.4 hw... strstr(gl_config.extensions_string, "GL_EXT_point_parameters") ) // should exist for all OGL 1.4 hw...
{ {
qglPointParameterf = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterf" ); qglPointParameterf = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterf" );
@ -1573,7 +1590,7 @@ RI_Init(void)
/* Non power of two textures */ /* Non power of two textures */
R_Printf(PRINT_ALL, " - Non power of two textures: "); R_Printf(PRINT_ALL, " - Non power of two textures: ");
if (strstr(gl_config.extensions_string, "GL_ARB_texture_non_power_of_two")) if (strstr(gl_config.extensions_string, GLEXTENSION_NPOT))
{ {
gl_config.npottextures = true; gl_config.npottextures = true;
R_Printf(PRINT_ALL, "Okay\n"); R_Printf(PRINT_ALL, "Okay\n");
@ -1584,6 +1601,8 @@ RI_Init(void)
R_Printf(PRINT_ALL, "Failed\n"); R_Printf(PRINT_ALL, "Failed\n");
} }
#undef GLEXTENSION_NPOT
// ---- // ----
/* Multitexturing */ /* Multitexturing */
@ -1591,7 +1610,7 @@ RI_Init(void)
R_Printf(PRINT_ALL, " - Multitexturing: "); R_Printf(PRINT_ALL, " - Multitexturing: ");
if (strstr(gl_config.extensions_string, "GL_ARB_multitexture")) if ( refresher == rf_opengles10 || strstr(gl_config.extensions_string, "GL_ARB_multitexture") )
{ {
qglActiveTexture = (void (APIENTRY *)(GLenum))RI_GetProcAddress ("glActiveTexture"); qglActiveTexture = (void (APIENTRY *)(GLenum))RI_GetProcAddress ("glActiveTexture");
qglClientActiveTexture = (void (APIENTRY *)(GLenum))RI_GetProcAddress ("glClientActiveTexture"); qglClientActiveTexture = (void (APIENTRY *)(GLenum))RI_GetProcAddress ("glClientActiveTexture");
@ -1780,6 +1799,7 @@ RI_BeginFrame(float camera_separation)
gl1_particle_square->modified = false; gl1_particle_square->modified = false;
} }
#ifndef YQ2_GL1_GLES
/* draw buffer stuff */ /* draw buffer stuff */
if (gl_drawbuffer->modified) if (gl_drawbuffer->modified)
{ {
@ -1797,6 +1817,7 @@ RI_BeginFrame(float camera_separation)
} }
} }
} }
#endif
/* texturemode stuff */ /* texturemode stuff */
if (gl_texturemode->modified || (gl_config.anisotropic && gl_anisotropic->modified) if (gl_texturemode->modified || (gl_config.anisotropic && gl_anisotropic->modified)

View file

@ -80,6 +80,7 @@ int RI_PrepareForWindow(void)
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
if (SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8) == 0) if (SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8) == 0)
{ {
@ -90,6 +91,12 @@ int RI_PrepareForWindow(void)
gl_state.stencil = false; gl_state.stencil = false;
} }
#ifdef YQ2_GL1_GLES
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif
// Let's see if the driver supports MSAA. // Let's see if the driver supports MSAA.
int msaa_samples = 0; int msaa_samples = 0;
@ -220,6 +227,21 @@ int RI_InitContext(void* win)
return false; return false;
} }
#ifdef YQ2_GL1_GLES
// Load GL pointers through GLAD and check context.
if( !gladLoadGLES1Loader(SDL_GL_GetProcAddress))
{
R_Printf(PRINT_ALL, "RI_InitContext(): ERROR: loading OpenGL ES function pointers failed!\n");
return false;
}
gl_config.major_version = GLVersion.major;
gl_config.minor_version = GLVersion.minor;
R_Printf(PRINT_ALL, "Initialized OpenGL ES version %d.%d context\n", gl_config.major_version, gl_config.minor_version);
#else
// Check if it's really OpenGL 1.4. // Check if it's really OpenGL 1.4.
const char* glver = (char *)glGetString(GL_VERSION); const char* glver = (char *)glGetString(GL_VERSION);
sscanf(glver, "%d.%d", &gl_config.major_version, &gl_config.minor_version); sscanf(glver, "%d.%d", &gl_config.major_version, &gl_config.minor_version);
@ -231,6 +253,8 @@ int RI_InitContext(void* win)
return false; return false;
} }
#endif
// Check if we've got the requested MSAA. // Check if we've got the requested MSAA.
int msaa_samples = 0; int msaa_samples = 0;
@ -262,7 +286,11 @@ int RI_InitContext(void* win)
// Window title - set here so we can display renderer name in it. // Window title - set here so we can display renderer name in it.
char title[40] = {0}; char title[40] = {0};
#ifdef YQ2_GL1_GLES
snprintf(title, sizeof(title), "Yamagi Quake II %s - OpenGL ES 1.0", YQ2VERSION);
#else
snprintf(title, sizeof(title), "Yamagi Quake II %s - OpenGL 1.4", YQ2VERSION); snprintf(title, sizeof(title), "Yamagi Quake II %s - OpenGL 1.4", YQ2VERSION);
#endif
SDL_SetWindowTitle(window, title); SDL_SetWindowTitle(window, title);
#if SDL_VERSION_ATLEAST(2, 26, 0) #if SDL_VERSION_ATLEAST(2, 26, 0)

View file

@ -604,9 +604,12 @@ static void
R_RegenAllLightmaps() R_RegenAllLightmaps()
{ {
int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br; int i, map, smax, tmax, top, bottom, left, right, bt, bb, bl, br;
qboolean affected_lightmap, pixelstore_set = false;
msurface_t *surf; msurface_t *surf;
byte *base; byte *base;
qboolean affected_lightmap;
#ifndef YQ2_GL1_GLES
qboolean pixelstore_set = false;
#endif
if ( !gl_config.multitexture ) if ( !gl_config.multitexture )
{ {
@ -672,25 +675,38 @@ R_RegenAllLightmaps()
continue; continue;
} }
#ifndef YQ2_GL1_GLES
if (!pixelstore_set) if (!pixelstore_set)
{ {
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width); glPixelStorei(GL_UNPACK_ROW_LENGTH, gl_state.block_width);
pixelstore_set = true; pixelstore_set = true;
} }
#endif
base = gl_lms.lightmap_buffer[i];
base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES;
// upload changes // upload changes
base = gl_lms.lightmap_buffer[i];
#ifdef YQ2_GL1_GLES
base += (bt * gl_state.block_width) * LIGHTMAP_BYTES;
R_Bind(gl_state.lightmap_textures + i);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, bt, gl_state.block_width, bb - bt,
GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base);
#else
base += (bt * gl_state.block_width + bl) * LIGHTMAP_BYTES;
R_Bind(gl_state.lightmap_textures + i); R_Bind(gl_state.lightmap_textures + i);
glTexSubImage2D(GL_TEXTURE_2D, 0, bl, bt, br - bl, bb - bt, glTexSubImage2D(GL_TEXTURE_2D, 0, bl, bt, br - bl, bb - bt,
GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base); GL_LIGHTMAP_FORMAT, GL_UNSIGNED_BYTE, base);
#endif
} }
#ifndef YQ2_GL1_GLES
if (pixelstore_set) if (pixelstore_set)
{ {
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
} }
#endif
} }
static void static void

View file

@ -0,0 +1,311 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
/*
* To support platform where unsigned long cannot be used interchangeably with
* inptr_t (e.g. CHERI-extended ISAs), we can use the stdint.h intptr_t.
* Ideally, we could just use (u)intptr_t everywhere, but this could result in
* ABI breakage if khronos_uintptr_t is changed from unsigned long to
* unsigned long long or similar (this results in different C++ name mangling).
* To avoid changes for existing platforms, we restrict usage of intptr_t to
* platforms where the size of a pointer is larger than the size of long.
*/
#if defined(__SIZEOF_LONG__) && defined(__SIZEOF_POINTER__)
#if __SIZEOF_POINTER__ > __SIZEOF_LONG__
#define KHRONOS_USE_INTPTR_T
#endif
#endif
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef KHRONOS_USE_INTPTR_T
typedef intptr_t khronos_intptr_t;
typedef uintptr_t khronos_uintptr_t;
#elif defined(_WIN64)
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
#endif
#if defined(_WIN64)
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,634 @@
/*
OpenGL ES loader generated by glad 0.1.36 on Tue Dec 20 14:35:00 2022.
Language/Generator: C/C++
Specification: gl
APIs: gles1=1.0
Profile: core
Extensions:
GL_EXT_debug_marker,
GL_EXT_discard_framebuffer,
GL_EXT_texture_format_BGRA8888,
GL_OES_EGL_image,
GL_OES_EGL_image_external,
GL_OES_compressed_ETC1_RGB8_texture,
GL_OES_compressed_paletted_texture,
GL_OES_depth24,
GL_OES_depth32,
GL_OES_draw_texture,
GL_OES_framebuffer_object,
GL_OES_mapbuffer,
GL_OES_matrix_palette,
GL_OES_query_matrix,
GL_OES_rgb8_rgba8,
GL_OES_stencil8,
GL_OES_texture_npot
Loader: False
Local files: False
Omit khrplatform: False
Reproducible: False
Commandline:
--profile="core" --api="gles1=1.0" --generator="c" --spec="gl" --no-loader --extensions="GL_EXT_debug_marker,GL_EXT_discard_framebuffer,GL_EXT_texture_format_BGRA8888,GL_OES_EGL_image,GL_OES_EGL_image_external,GL_OES_compressed_ETC1_RGB8_texture,GL_OES_compressed_paletted_texture,GL_OES_depth24,GL_OES_depth32,GL_OES_draw_texture,GL_OES_framebuffer_object,GL_OES_mapbuffer,GL_OES_matrix_palette,GL_OES_query_matrix,GL_OES_rgb8_rgba8,GL_OES_stencil8,GL_OES_texture_npot"
Online:
https://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gles1%3D1.0&extensions=GL_EXT_debug_marker&extensions=GL_EXT_discard_framebuffer&extensions=GL_EXT_texture_format_BGRA8888&extensions=GL_OES_EGL_image&extensions=GL_OES_EGL_image_external&extensions=GL_OES_compressed_ETC1_RGB8_texture&extensions=GL_OES_compressed_paletted_texture&extensions=GL_OES_depth24&extensions=GL_OES_depth32&extensions=GL_OES_draw_texture&extensions=GL_OES_framebuffer_object&extensions=GL_OES_mapbuffer&extensions=GL_OES_matrix_palette&extensions=GL_OES_query_matrix&extensions=GL_OES_rgb8_rgba8&extensions=GL_OES_stencil8&extensions=GL_OES_texture_npot
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/glad.h>
struct gladGLversionStruct GLVersion = { 0, 0 };
#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
#define _GLAD_IS_SOME_NEW_VERSION 1
#endif
static int max_loaded_major;
static int max_loaded_minor;
static const char *exts = NULL;
static int num_exts_i = 0;
static char **exts_i = NULL;
static int get_exts(void) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
if(max_loaded_major < 3) {
#endif
exts = (const char *)glGetString(GL_EXTENSIONS);
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
unsigned int index;
num_exts_i = 0;
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
if (num_exts_i > 0) {
exts_i = (char **)malloc((size_t)num_exts_i * (sizeof *exts_i));
}
if (exts_i == NULL) {
return 0;
}
for(index = 0; index < (unsigned)num_exts_i; index++) {
const char *gl_str_tmp = (const char*)glGetStringi(GL_EXTENSIONS, index);
size_t len = strlen(gl_str_tmp);
char *local_str = (char*)malloc((len+1) * sizeof(char));
if(local_str != NULL) {
memcpy(local_str, gl_str_tmp, (len+1) * sizeof(char));
}
exts_i[index] = local_str;
}
}
#endif
return 1;
}
static void free_exts(void) {
if (exts_i != NULL) {
int index;
for(index = 0; index < num_exts_i; index++) {
free((char *)exts_i[index]);
}
free((void *)exts_i);
exts_i = NULL;
}
}
static int has_ext(const char *ext) {
#ifdef _GLAD_IS_SOME_NEW_VERSION
if(max_loaded_major < 3) {
#endif
const char *extensions;
const char *loc;
const char *terminator;
extensions = exts;
if(extensions == NULL || ext == NULL) {
return 0;
}
while(1) {
loc = strstr(extensions, ext);
if(loc == NULL) {
return 0;
}
terminator = loc + strlen(ext);
if((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0')) {
return 1;
}
extensions = terminator;
}
#ifdef _GLAD_IS_SOME_NEW_VERSION
} else {
int index;
if(exts_i == NULL) return 0;
for(index = 0; index < num_exts_i; index++) {
const char *e = exts_i[index];
if(exts_i[index] != NULL && strcmp(e, ext) == 0) {
return 1;
}
}
}
#endif
return 0;
}
int GLAD_GL_VERSION_ES_CM_1_0 = 0;
PFNGLACTIVETEXTUREPROC glad_glActiveTexture = NULL;
PFNGLALPHAFUNCPROC glad_glAlphaFunc = NULL;
PFNGLALPHAFUNCXPROC glad_glAlphaFuncx = NULL;
PFNGLBINDBUFFERPROC glad_glBindBuffer = NULL;
PFNGLBINDTEXTUREPROC glad_glBindTexture = NULL;
PFNGLBLENDFUNCPROC glad_glBlendFunc = NULL;
PFNGLBUFFERDATAPROC glad_glBufferData = NULL;
PFNGLBUFFERSUBDATAPROC glad_glBufferSubData = NULL;
PFNGLCLEARPROC glad_glClear = NULL;
PFNGLCLEARCOLORPROC glad_glClearColor = NULL;
PFNGLCLEARCOLORXPROC glad_glClearColorx = NULL;
PFNGLCLEARDEPTHFPROC glad_glClearDepthf = NULL;
PFNGLCLEARDEPTHXPROC glad_glClearDepthx = NULL;
PFNGLCLEARSTENCILPROC glad_glClearStencil = NULL;
PFNGLCLIENTACTIVETEXTUREPROC glad_glClientActiveTexture = NULL;
PFNGLCLIPPLANEFPROC glad_glClipPlanef = NULL;
PFNGLCLIPPLANEXPROC glad_glClipPlanex = NULL;
PFNGLCOLOR4FPROC glad_glColor4f = NULL;
PFNGLCOLOR4UBPROC glad_glColor4ub = NULL;
PFNGLCOLOR4XPROC glad_glColor4x = NULL;
PFNGLCOLORMASKPROC glad_glColorMask = NULL;
PFNGLCOLORPOINTERPROC glad_glColorPointer = NULL;
PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D = NULL;
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D = NULL;
PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D = NULL;
PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D = NULL;
PFNGLCULLFACEPROC glad_glCullFace = NULL;
PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers = NULL;
PFNGLDELETETEXTURESPROC glad_glDeleteTextures = NULL;
PFNGLDEPTHFUNCPROC glad_glDepthFunc = NULL;
PFNGLDEPTHMASKPROC glad_glDepthMask = NULL;
PFNGLDEPTHRANGEFPROC glad_glDepthRangef = NULL;
PFNGLDEPTHRANGEXPROC glad_glDepthRangex = NULL;
PFNGLDISABLEPROC glad_glDisable = NULL;
PFNGLDISABLECLIENTSTATEPROC glad_glDisableClientState = NULL;
PFNGLDRAWARRAYSPROC glad_glDrawArrays = NULL;
PFNGLDRAWELEMENTSPROC glad_glDrawElements = NULL;
PFNGLENABLEPROC glad_glEnable = NULL;
PFNGLENABLECLIENTSTATEPROC glad_glEnableClientState = NULL;
PFNGLFINISHPROC glad_glFinish = NULL;
PFNGLFLUSHPROC glad_glFlush = NULL;
PFNGLFOGFPROC glad_glFogf = NULL;
PFNGLFOGFVPROC glad_glFogfv = NULL;
PFNGLFOGXPROC glad_glFogx = NULL;
PFNGLFOGXVPROC glad_glFogxv = NULL;
PFNGLFRONTFACEPROC glad_glFrontFace = NULL;
PFNGLFRUSTUMFPROC glad_glFrustumf = NULL;
PFNGLFRUSTUMXPROC glad_glFrustumx = NULL;
PFNGLGENBUFFERSPROC glad_glGenBuffers = NULL;
PFNGLGENTEXTURESPROC glad_glGenTextures = NULL;
PFNGLGETBOOLEANVPROC glad_glGetBooleanv = NULL;
PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv = NULL;
PFNGLGETCLIPPLANEFPROC glad_glGetClipPlanef = NULL;
PFNGLGETCLIPPLANEXPROC glad_glGetClipPlanex = NULL;
PFNGLGETERRORPROC glad_glGetError = NULL;
PFNGLGETFIXEDVPROC glad_glGetFixedv = NULL;
PFNGLGETFLOATVPROC glad_glGetFloatv = NULL;
PFNGLGETINTEGERVPROC glad_glGetIntegerv = NULL;
PFNGLGETLIGHTFVPROC glad_glGetLightfv = NULL;
PFNGLGETLIGHTXVPROC glad_glGetLightxv = NULL;
PFNGLGETMATERIALFVPROC glad_glGetMaterialfv = NULL;
PFNGLGETMATERIALXVPROC glad_glGetMaterialxv = NULL;
PFNGLGETPOINTERVPROC glad_glGetPointerv = NULL;
PFNGLGETSTRINGPROC glad_glGetString = NULL;
PFNGLGETTEXENVFVPROC glad_glGetTexEnvfv = NULL;
PFNGLGETTEXENVIVPROC glad_glGetTexEnviv = NULL;
PFNGLGETTEXENVXVPROC glad_glGetTexEnvxv = NULL;
PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv = NULL;
PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv = NULL;
PFNGLGETTEXPARAMETERXVPROC glad_glGetTexParameterxv = NULL;
PFNGLHINTPROC glad_glHint = NULL;
PFNGLISBUFFERPROC glad_glIsBuffer = NULL;
PFNGLISENABLEDPROC glad_glIsEnabled = NULL;
PFNGLISTEXTUREPROC glad_glIsTexture = NULL;
PFNGLLIGHTMODELFPROC glad_glLightModelf = NULL;
PFNGLLIGHTMODELFVPROC glad_glLightModelfv = NULL;
PFNGLLIGHTMODELXPROC glad_glLightModelx = NULL;
PFNGLLIGHTMODELXVPROC glad_glLightModelxv = NULL;
PFNGLLIGHTFPROC glad_glLightf = NULL;
PFNGLLIGHTFVPROC glad_glLightfv = NULL;
PFNGLLIGHTXPROC glad_glLightx = NULL;
PFNGLLIGHTXVPROC glad_glLightxv = NULL;
PFNGLLINEWIDTHPROC glad_glLineWidth = NULL;
PFNGLLINEWIDTHXPROC glad_glLineWidthx = NULL;
PFNGLLOADIDENTITYPROC glad_glLoadIdentity = NULL;
PFNGLLOADMATRIXFPROC glad_glLoadMatrixf = NULL;
PFNGLLOADMATRIXXPROC glad_glLoadMatrixx = NULL;
PFNGLLOGICOPPROC glad_glLogicOp = NULL;
PFNGLMATERIALFPROC glad_glMaterialf = NULL;
PFNGLMATERIALFVPROC glad_glMaterialfv = NULL;
PFNGLMATERIALXPROC glad_glMaterialx = NULL;
PFNGLMATERIALXVPROC glad_glMaterialxv = NULL;
PFNGLMATRIXMODEPROC glad_glMatrixMode = NULL;
PFNGLMULTMATRIXFPROC glad_glMultMatrixf = NULL;
PFNGLMULTMATRIXXPROC glad_glMultMatrixx = NULL;
PFNGLMULTITEXCOORD4FPROC glad_glMultiTexCoord4f = NULL;
PFNGLMULTITEXCOORD4XPROC glad_glMultiTexCoord4x = NULL;
PFNGLNORMAL3FPROC glad_glNormal3f = NULL;
PFNGLNORMAL3XPROC glad_glNormal3x = NULL;
PFNGLNORMALPOINTERPROC glad_glNormalPointer = NULL;
PFNGLORTHOFPROC glad_glOrthof = NULL;
PFNGLORTHOXPROC glad_glOrthox = NULL;
PFNGLPIXELSTOREIPROC glad_glPixelStorei = NULL;
PFNGLPOINTPARAMETERFPROC glad_glPointParameterf = NULL;
PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv = NULL;
PFNGLPOINTPARAMETERXPROC glad_glPointParameterx = NULL;
PFNGLPOINTPARAMETERXVPROC glad_glPointParameterxv = NULL;
PFNGLPOINTSIZEPROC glad_glPointSize = NULL;
PFNGLPOINTSIZEXPROC glad_glPointSizex = NULL;
PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset = NULL;
PFNGLPOLYGONOFFSETXPROC glad_glPolygonOffsetx = NULL;
PFNGLPOPMATRIXPROC glad_glPopMatrix = NULL;
PFNGLPUSHMATRIXPROC glad_glPushMatrix = NULL;
PFNGLREADPIXELSPROC glad_glReadPixels = NULL;
PFNGLROTATEFPROC glad_glRotatef = NULL;
PFNGLROTATEXPROC glad_glRotatex = NULL;
PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage = NULL;
PFNGLSAMPLECOVERAGEXPROC glad_glSampleCoveragex = NULL;
PFNGLSCALEFPROC glad_glScalef = NULL;
PFNGLSCALEXPROC glad_glScalex = NULL;
PFNGLSCISSORPROC glad_glScissor = NULL;
PFNGLSHADEMODELPROC glad_glShadeModel = NULL;
PFNGLSTENCILFUNCPROC glad_glStencilFunc = NULL;
PFNGLSTENCILMASKPROC glad_glStencilMask = NULL;
PFNGLSTENCILOPPROC glad_glStencilOp = NULL;
PFNGLTEXCOORDPOINTERPROC glad_glTexCoordPointer = NULL;
PFNGLTEXENVFPROC glad_glTexEnvf = NULL;
PFNGLTEXENVFVPROC glad_glTexEnvfv = NULL;
PFNGLTEXENVIPROC glad_glTexEnvi = NULL;
PFNGLTEXENVIVPROC glad_glTexEnviv = NULL;
PFNGLTEXENVXPROC glad_glTexEnvx = NULL;
PFNGLTEXENVXVPROC glad_glTexEnvxv = NULL;
PFNGLTEXIMAGE2DPROC glad_glTexImage2D = NULL;
PFNGLTEXPARAMETERFPROC glad_glTexParameterf = NULL;
PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv = NULL;
PFNGLTEXPARAMETERIPROC glad_glTexParameteri = NULL;
PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv = NULL;
PFNGLTEXPARAMETERXPROC glad_glTexParameterx = NULL;
PFNGLTEXPARAMETERXVPROC glad_glTexParameterxv = NULL;
PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D = NULL;
PFNGLTRANSLATEFPROC glad_glTranslatef = NULL;
PFNGLTRANSLATEXPROC glad_glTranslatex = NULL;
PFNGLVERTEXPOINTERPROC glad_glVertexPointer = NULL;
PFNGLVIEWPORTPROC glad_glViewport = NULL;
int GLAD_GL_EXT_debug_marker = 0;
int GLAD_GL_EXT_discard_framebuffer = 0;
int GLAD_GL_EXT_texture_format_BGRA8888 = 0;
int GLAD_GL_OES_EGL_image = 0;
int GLAD_GL_OES_EGL_image_external = 0;
int GLAD_GL_OES_compressed_ETC1_RGB8_texture = 0;
int GLAD_GL_OES_compressed_paletted_texture = 0;
int GLAD_GL_OES_depth24 = 0;
int GLAD_GL_OES_depth32 = 0;
int GLAD_GL_OES_draw_texture = 0;
int GLAD_GL_OES_framebuffer_object = 0;
int GLAD_GL_OES_mapbuffer = 0;
int GLAD_GL_OES_matrix_palette = 0;
int GLAD_GL_OES_query_matrix = 0;
int GLAD_GL_OES_rgb8_rgba8 = 0;
int GLAD_GL_OES_stencil8 = 0;
int GLAD_GL_OES_texture_npot = 0;
PFNGLINSERTEVENTMARKEREXTPROC glad_glInsertEventMarkerEXT = NULL;
PFNGLPUSHGROUPMARKEREXTPROC glad_glPushGroupMarkerEXT = NULL;
PFNGLPOPGROUPMARKEREXTPROC glad_glPopGroupMarkerEXT = NULL;
PFNGLDISCARDFRAMEBUFFEREXTPROC glad_glDiscardFramebufferEXT = NULL;
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glad_glEGLImageTargetTexture2DOES = NULL;
PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glad_glEGLImageTargetRenderbufferStorageOES = NULL;
PFNGLDRAWTEXSOESPROC glad_glDrawTexsOES = NULL;
PFNGLDRAWTEXIOESPROC glad_glDrawTexiOES = NULL;
PFNGLDRAWTEXXOESPROC glad_glDrawTexxOES = NULL;
PFNGLDRAWTEXSVOESPROC glad_glDrawTexsvOES = NULL;
PFNGLDRAWTEXIVOESPROC glad_glDrawTexivOES = NULL;
PFNGLDRAWTEXXVOESPROC glad_glDrawTexxvOES = NULL;
PFNGLDRAWTEXFOESPROC glad_glDrawTexfOES = NULL;
PFNGLDRAWTEXFVOESPROC glad_glDrawTexfvOES = NULL;
PFNGLISRENDERBUFFEROESPROC glad_glIsRenderbufferOES = NULL;
PFNGLBINDRENDERBUFFEROESPROC glad_glBindRenderbufferOES = NULL;
PFNGLDELETERENDERBUFFERSOESPROC glad_glDeleteRenderbuffersOES = NULL;
PFNGLGENRENDERBUFFERSOESPROC glad_glGenRenderbuffersOES = NULL;
PFNGLRENDERBUFFERSTORAGEOESPROC glad_glRenderbufferStorageOES = NULL;
PFNGLGETRENDERBUFFERPARAMETERIVOESPROC glad_glGetRenderbufferParameterivOES = NULL;
PFNGLISFRAMEBUFFEROESPROC glad_glIsFramebufferOES = NULL;
PFNGLBINDFRAMEBUFFEROESPROC glad_glBindFramebufferOES = NULL;
PFNGLDELETEFRAMEBUFFERSOESPROC glad_glDeleteFramebuffersOES = NULL;
PFNGLGENFRAMEBUFFERSOESPROC glad_glGenFramebuffersOES = NULL;
PFNGLCHECKFRAMEBUFFERSTATUSOESPROC glad_glCheckFramebufferStatusOES = NULL;
PFNGLFRAMEBUFFERRENDERBUFFEROESPROC glad_glFramebufferRenderbufferOES = NULL;
PFNGLFRAMEBUFFERTEXTURE2DOESPROC glad_glFramebufferTexture2DOES = NULL;
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC glad_glGetFramebufferAttachmentParameterivOES = NULL;
PFNGLGENERATEMIPMAPOESPROC glad_glGenerateMipmapOES = NULL;
PFNGLMAPBUFFEROESPROC glad_glMapBufferOES = NULL;
PFNGLUNMAPBUFFEROESPROC glad_glUnmapBufferOES = NULL;
PFNGLGETBUFFERPOINTERVOESPROC glad_glGetBufferPointervOES = NULL;
PFNGLCURRENTPALETTEMATRIXOESPROC glad_glCurrentPaletteMatrixOES = NULL;
PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC glad_glLoadPaletteFromModelViewMatrixOES = NULL;
PFNGLMATRIXINDEXPOINTEROESPROC glad_glMatrixIndexPointerOES = NULL;
PFNGLWEIGHTPOINTEROESPROC glad_glWeightPointerOES = NULL;
PFNGLQUERYMATRIXXOESPROC glad_glQueryMatrixxOES = NULL;
static void load_GL_VERSION_ES_CM_1_0(GLADloadproc load) {
if(!GLAD_GL_VERSION_ES_CM_1_0) return;
glad_glAlphaFunc = (PFNGLALPHAFUNCPROC)load("glAlphaFunc");
glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor");
glad_glClearDepthf = (PFNGLCLEARDEPTHFPROC)load("glClearDepthf");
glad_glClipPlanef = (PFNGLCLIPPLANEFPROC)load("glClipPlanef");
glad_glColor4f = (PFNGLCOLOR4FPROC)load("glColor4f");
glad_glDepthRangef = (PFNGLDEPTHRANGEFPROC)load("glDepthRangef");
glad_glFogf = (PFNGLFOGFPROC)load("glFogf");
glad_glFogfv = (PFNGLFOGFVPROC)load("glFogfv");
glad_glFrustumf = (PFNGLFRUSTUMFPROC)load("glFrustumf");
glad_glGetClipPlanef = (PFNGLGETCLIPPLANEFPROC)load("glGetClipPlanef");
glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv");
glad_glGetLightfv = (PFNGLGETLIGHTFVPROC)load("glGetLightfv");
glad_glGetMaterialfv = (PFNGLGETMATERIALFVPROC)load("glGetMaterialfv");
glad_glGetTexEnvfv = (PFNGLGETTEXENVFVPROC)load("glGetTexEnvfv");
glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv");
glad_glLightModelf = (PFNGLLIGHTMODELFPROC)load("glLightModelf");
glad_glLightModelfv = (PFNGLLIGHTMODELFVPROC)load("glLightModelfv");
glad_glLightf = (PFNGLLIGHTFPROC)load("glLightf");
glad_glLightfv = (PFNGLLIGHTFVPROC)load("glLightfv");
glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth");
glad_glLoadMatrixf = (PFNGLLOADMATRIXFPROC)load("glLoadMatrixf");
glad_glMaterialf = (PFNGLMATERIALFPROC)load("glMaterialf");
glad_glMaterialfv = (PFNGLMATERIALFVPROC)load("glMaterialfv");
glad_glMultMatrixf = (PFNGLMULTMATRIXFPROC)load("glMultMatrixf");
glad_glMultiTexCoord4f = (PFNGLMULTITEXCOORD4FPROC)load("glMultiTexCoord4f");
glad_glNormal3f = (PFNGLNORMAL3FPROC)load("glNormal3f");
glad_glOrthof = (PFNGLORTHOFPROC)load("glOrthof");
glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf");
glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv");
glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize");
glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset");
glad_glRotatef = (PFNGLROTATEFPROC)load("glRotatef");
glad_glScalef = (PFNGLSCALEFPROC)load("glScalef");
glad_glTexEnvf = (PFNGLTEXENVFPROC)load("glTexEnvf");
glad_glTexEnvfv = (PFNGLTEXENVFVPROC)load("glTexEnvfv");
glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf");
glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv");
glad_glTranslatef = (PFNGLTRANSLATEFPROC)load("glTranslatef");
glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture");
glad_glAlphaFuncx = (PFNGLALPHAFUNCXPROC)load("glAlphaFuncx");
glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer");
glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture");
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData");
glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData");
glad_glClear = (PFNGLCLEARPROC)load("glClear");
glad_glClearColorx = (PFNGLCLEARCOLORXPROC)load("glClearColorx");
glad_glClearDepthx = (PFNGLCLEARDEPTHXPROC)load("glClearDepthx");
glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil");
glad_glClientActiveTexture = (PFNGLCLIENTACTIVETEXTUREPROC)load("glClientActiveTexture");
glad_glClipPlanex = (PFNGLCLIPPLANEXPROC)load("glClipPlanex");
glad_glColor4ub = (PFNGLCOLOR4UBPROC)load("glColor4ub");
glad_glColor4x = (PFNGLCOLOR4XPROC)load("glColor4x");
glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask");
glad_glColorPointer = (PFNGLCOLORPOINTERPROC)load("glColorPointer");
glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D");
glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D");
glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D");
glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D");
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers");
glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures");
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask");
glad_glDepthRangex = (PFNGLDEPTHRANGEXPROC)load("glDepthRangex");
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
glad_glDisableClientState = (PFNGLDISABLECLIENTSTATEPROC)load("glDisableClientState");
glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays");
glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements");
glad_glEnable = (PFNGLENABLEPROC)load("glEnable");
glad_glEnableClientState = (PFNGLENABLECLIENTSTATEPROC)load("glEnableClientState");
glad_glFinish = (PFNGLFINISHPROC)load("glFinish");
glad_glFlush = (PFNGLFLUSHPROC)load("glFlush");
glad_glFogx = (PFNGLFOGXPROC)load("glFogx");
glad_glFogxv = (PFNGLFOGXVPROC)load("glFogxv");
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");
glad_glFrustumx = (PFNGLFRUSTUMXPROC)load("glFrustumx");
glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv");
glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
glad_glGetClipPlanex = (PFNGLGETCLIPPLANEXPROC)load("glGetClipPlanex");
glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers");
glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures");
glad_glGetError = (PFNGLGETERRORPROC)load("glGetError");
glad_glGetFixedv = (PFNGLGETFIXEDVPROC)load("glGetFixedv");
glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv");
glad_glGetLightxv = (PFNGLGETLIGHTXVPROC)load("glGetLightxv");
glad_glGetMaterialxv = (PFNGLGETMATERIALXVPROC)load("glGetMaterialxv");
glad_glGetPointerv = (PFNGLGETPOINTERVPROC)load("glGetPointerv");
glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
glad_glGetTexEnviv = (PFNGLGETTEXENVIVPROC)load("glGetTexEnviv");
glad_glGetTexEnvxv = (PFNGLGETTEXENVXVPROC)load("glGetTexEnvxv");
glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv");
glad_glGetTexParameterxv = (PFNGLGETTEXPARAMETERXVPROC)load("glGetTexParameterxv");
glad_glHint = (PFNGLHINTPROC)load("glHint");
glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer");
glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled");
glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture");
glad_glLightModelx = (PFNGLLIGHTMODELXPROC)load("glLightModelx");
glad_glLightModelxv = (PFNGLLIGHTMODELXVPROC)load("glLightModelxv");
glad_glLightx = (PFNGLLIGHTXPROC)load("glLightx");
glad_glLightxv = (PFNGLLIGHTXVPROC)load("glLightxv");
glad_glLineWidthx = (PFNGLLINEWIDTHXPROC)load("glLineWidthx");
glad_glLoadIdentity = (PFNGLLOADIDENTITYPROC)load("glLoadIdentity");
glad_glLoadMatrixx = (PFNGLLOADMATRIXXPROC)load("glLoadMatrixx");
glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp");
glad_glMaterialx = (PFNGLMATERIALXPROC)load("glMaterialx");
glad_glMaterialxv = (PFNGLMATERIALXVPROC)load("glMaterialxv");
glad_glMatrixMode = (PFNGLMATRIXMODEPROC)load("glMatrixMode");
glad_glMultMatrixx = (PFNGLMULTMATRIXXPROC)load("glMultMatrixx");
glad_glMultiTexCoord4x = (PFNGLMULTITEXCOORD4XPROC)load("glMultiTexCoord4x");
glad_glNormal3x = (PFNGLNORMAL3XPROC)load("glNormal3x");
glad_glNormalPointer = (PFNGLNORMALPOINTERPROC)load("glNormalPointer");
glad_glOrthox = (PFNGLORTHOXPROC)load("glOrthox");
glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei");
glad_glPointParameterx = (PFNGLPOINTPARAMETERXPROC)load("glPointParameterx");
glad_glPointParameterxv = (PFNGLPOINTPARAMETERXVPROC)load("glPointParameterxv");
glad_glPointSizex = (PFNGLPOINTSIZEXPROC)load("glPointSizex");
glad_glPolygonOffsetx = (PFNGLPOLYGONOFFSETXPROC)load("glPolygonOffsetx");
glad_glPopMatrix = (PFNGLPOPMATRIXPROC)load("glPopMatrix");
glad_glPushMatrix = (PFNGLPUSHMATRIXPROC)load("glPushMatrix");
glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels");
glad_glRotatex = (PFNGLROTATEXPROC)load("glRotatex");
glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage");
glad_glSampleCoveragex = (PFNGLSAMPLECOVERAGEXPROC)load("glSampleCoveragex");
glad_glScalex = (PFNGLSCALEXPROC)load("glScalex");
glad_glScissor = (PFNGLSCISSORPROC)load("glScissor");
glad_glShadeModel = (PFNGLSHADEMODELPROC)load("glShadeModel");
glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc");
glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask");
glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp");
glad_glTexCoordPointer = (PFNGLTEXCOORDPOINTERPROC)load("glTexCoordPointer");
glad_glTexEnvi = (PFNGLTEXENVIPROC)load("glTexEnvi");
glad_glTexEnvx = (PFNGLTEXENVXPROC)load("glTexEnvx");
glad_glTexEnviv = (PFNGLTEXENVIVPROC)load("glTexEnviv");
glad_glTexEnvxv = (PFNGLTEXENVXVPROC)load("glTexEnvxv");
glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D");
glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri");
glad_glTexParameterx = (PFNGLTEXPARAMETERXPROC)load("glTexParameterx");
glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv");
glad_glTexParameterxv = (PFNGLTEXPARAMETERXVPROC)load("glTexParameterxv");
glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D");
glad_glTranslatex = (PFNGLTRANSLATEXPROC)load("glTranslatex");
glad_glVertexPointer = (PFNGLVERTEXPOINTERPROC)load("glVertexPointer");
glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport");
}
static void load_GL_EXT_debug_marker(GLADloadproc load) {
if(!GLAD_GL_EXT_debug_marker) return;
glad_glInsertEventMarkerEXT = (PFNGLINSERTEVENTMARKEREXTPROC)load("glInsertEventMarkerEXT");
glad_glPushGroupMarkerEXT = (PFNGLPUSHGROUPMARKEREXTPROC)load("glPushGroupMarkerEXT");
glad_glPopGroupMarkerEXT = (PFNGLPOPGROUPMARKEREXTPROC)load("glPopGroupMarkerEXT");
}
static void load_GL_EXT_discard_framebuffer(GLADloadproc load) {
if(!GLAD_GL_EXT_discard_framebuffer) return;
glad_glDiscardFramebufferEXT = (PFNGLDISCARDFRAMEBUFFEREXTPROC)load("glDiscardFramebufferEXT");
}
static void load_GL_OES_EGL_image(GLADloadproc load) {
if(!GLAD_GL_OES_EGL_image) return;
glad_glEGLImageTargetTexture2DOES = (PFNGLEGLIMAGETARGETTEXTURE2DOESPROC)load("glEGLImageTargetTexture2DOES");
glad_glEGLImageTargetRenderbufferStorageOES = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC)load("glEGLImageTargetRenderbufferStorageOES");
}
static void load_GL_OES_draw_texture(GLADloadproc load) {
if(!GLAD_GL_OES_draw_texture) return;
glad_glDrawTexsOES = (PFNGLDRAWTEXSOESPROC)load("glDrawTexsOES");
glad_glDrawTexiOES = (PFNGLDRAWTEXIOESPROC)load("glDrawTexiOES");
glad_glDrawTexxOES = (PFNGLDRAWTEXXOESPROC)load("glDrawTexxOES");
glad_glDrawTexsvOES = (PFNGLDRAWTEXSVOESPROC)load("glDrawTexsvOES");
glad_glDrawTexivOES = (PFNGLDRAWTEXIVOESPROC)load("glDrawTexivOES");
glad_glDrawTexxvOES = (PFNGLDRAWTEXXVOESPROC)load("glDrawTexxvOES");
glad_glDrawTexfOES = (PFNGLDRAWTEXFOESPROC)load("glDrawTexfOES");
glad_glDrawTexfvOES = (PFNGLDRAWTEXFVOESPROC)load("glDrawTexfvOES");
}
static void load_GL_OES_framebuffer_object(GLADloadproc load) {
if(!GLAD_GL_OES_framebuffer_object) return;
glad_glIsRenderbufferOES = (PFNGLISRENDERBUFFEROESPROC)load("glIsRenderbufferOES");
glad_glBindRenderbufferOES = (PFNGLBINDRENDERBUFFEROESPROC)load("glBindRenderbufferOES");
glad_glDeleteRenderbuffersOES = (PFNGLDELETERENDERBUFFERSOESPROC)load("glDeleteRenderbuffersOES");
glad_glGenRenderbuffersOES = (PFNGLGENRENDERBUFFERSOESPROC)load("glGenRenderbuffersOES");
glad_glRenderbufferStorageOES = (PFNGLRENDERBUFFERSTORAGEOESPROC)load("glRenderbufferStorageOES");
glad_glGetRenderbufferParameterivOES = (PFNGLGETRENDERBUFFERPARAMETERIVOESPROC)load("glGetRenderbufferParameterivOES");
glad_glIsFramebufferOES = (PFNGLISFRAMEBUFFEROESPROC)load("glIsFramebufferOES");
glad_glBindFramebufferOES = (PFNGLBINDFRAMEBUFFEROESPROC)load("glBindFramebufferOES");
glad_glDeleteFramebuffersOES = (PFNGLDELETEFRAMEBUFFERSOESPROC)load("glDeleteFramebuffersOES");
glad_glGenFramebuffersOES = (PFNGLGENFRAMEBUFFERSOESPROC)load("glGenFramebuffersOES");
glad_glCheckFramebufferStatusOES = (PFNGLCHECKFRAMEBUFFERSTATUSOESPROC)load("glCheckFramebufferStatusOES");
glad_glFramebufferRenderbufferOES = (PFNGLFRAMEBUFFERRENDERBUFFEROESPROC)load("glFramebufferRenderbufferOES");
glad_glFramebufferTexture2DOES = (PFNGLFRAMEBUFFERTEXTURE2DOESPROC)load("glFramebufferTexture2DOES");
glad_glGetFramebufferAttachmentParameterivOES = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC)load("glGetFramebufferAttachmentParameterivOES");
glad_glGenerateMipmapOES = (PFNGLGENERATEMIPMAPOESPROC)load("glGenerateMipmapOES");
}
static void load_GL_OES_mapbuffer(GLADloadproc load) {
if(!GLAD_GL_OES_mapbuffer) return;
glad_glMapBufferOES = (PFNGLMAPBUFFEROESPROC)load("glMapBufferOES");
glad_glUnmapBufferOES = (PFNGLUNMAPBUFFEROESPROC)load("glUnmapBufferOES");
glad_glGetBufferPointervOES = (PFNGLGETBUFFERPOINTERVOESPROC)load("glGetBufferPointervOES");
}
static void load_GL_OES_matrix_palette(GLADloadproc load) {
if(!GLAD_GL_OES_matrix_palette) return;
glad_glCurrentPaletteMatrixOES = (PFNGLCURRENTPALETTEMATRIXOESPROC)load("glCurrentPaletteMatrixOES");
glad_glLoadPaletteFromModelViewMatrixOES = (PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC)load("glLoadPaletteFromModelViewMatrixOES");
glad_glMatrixIndexPointerOES = (PFNGLMATRIXINDEXPOINTEROESPROC)load("glMatrixIndexPointerOES");
glad_glWeightPointerOES = (PFNGLWEIGHTPOINTEROESPROC)load("glWeightPointerOES");
}
static void load_GL_OES_query_matrix(GLADloadproc load) {
if(!GLAD_GL_OES_query_matrix) return;
glad_glQueryMatrixxOES = (PFNGLQUERYMATRIXXOESPROC)load("glQueryMatrixxOES");
}
static int find_extensionsGLES1(void) {
if (!get_exts()) return 0;
GLAD_GL_EXT_debug_marker = has_ext("GL_EXT_debug_marker");
GLAD_GL_EXT_discard_framebuffer = has_ext("GL_EXT_discard_framebuffer");
GLAD_GL_EXT_texture_format_BGRA8888 = has_ext("GL_EXT_texture_format_BGRA8888");
GLAD_GL_OES_EGL_image = has_ext("GL_OES_EGL_image");
GLAD_GL_OES_EGL_image_external = has_ext("GL_OES_EGL_image_external");
GLAD_GL_OES_compressed_ETC1_RGB8_texture = has_ext("GL_OES_compressed_ETC1_RGB8_texture");
GLAD_GL_OES_compressed_paletted_texture = has_ext("GL_OES_compressed_paletted_texture");
GLAD_GL_OES_depth24 = has_ext("GL_OES_depth24");
GLAD_GL_OES_depth32 = has_ext("GL_OES_depth32");
GLAD_GL_OES_draw_texture = has_ext("GL_OES_draw_texture");
GLAD_GL_OES_framebuffer_object = has_ext("GL_OES_framebuffer_object");
GLAD_GL_OES_mapbuffer = has_ext("GL_OES_mapbuffer");
GLAD_GL_OES_matrix_palette = has_ext("GL_OES_matrix_palette");
GLAD_GL_OES_query_matrix = has_ext("GL_OES_query_matrix");
GLAD_GL_OES_rgb8_rgba8 = has_ext("GL_OES_rgb8_rgba8");
GLAD_GL_OES_stencil8 = has_ext("GL_OES_stencil8");
GLAD_GL_OES_texture_npot = has_ext("GL_OES_texture_npot");
free_exts();
return 1;
}
static void find_coreGLES1(void) {
/* Thank you @elmindreda
* https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176
* https://github.com/glfw/glfw/blob/master/src/context.c#L36
*/
int i, major, minor;
const char* version;
const char* prefixes[] = {
"OpenGL ES-CM ",
"OpenGL ES-CL ",
"OpenGL ES ",
NULL
};
version = (const char*) glGetString(GL_VERSION);
if (!version) return;
for (i = 0; prefixes[i]; i++) {
const size_t length = strlen(prefixes[i]);
if (strncmp(version, prefixes[i], length) == 0) {
version += length;
break;
}
}
/* PR #18 */
#ifdef _MSC_VER
sscanf_s(version, "%d.%d", &major, &minor);
#else
sscanf(version, "%d.%d", &major, &minor);
#endif
GLVersion.major = major; GLVersion.minor = minor;
max_loaded_major = major; max_loaded_minor = minor;
GLAD_GL_VERSION_ES_CM_1_0 = (major == 1 && minor >= 0) || major > 1;
if (GLVersion.major > 1 || (GLVersion.major >= 1 && GLVersion.minor >= 0)) {
max_loaded_major = 1;
max_loaded_minor = 0;
}
}
int gladLoadGLES1Loader(GLADloadproc load) {
GLVersion.major = 0; GLVersion.minor = 0;
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
if(glGetString == NULL) return 0;
if(glGetString(GL_VERSION) == NULL) return 0;
find_coreGLES1();
load_GL_VERSION_ES_CM_1_0(load);
if (!find_extensionsGLES1()) return 0;
load_GL_EXT_debug_marker(load);
load_GL_EXT_discard_framebuffer(load);
load_GL_OES_EGL_image(load);
load_GL_OES_draw_texture(load);
load_GL_OES_framebuffer_object(load);
load_GL_OES_mapbuffer(load);
load_GL_OES_matrix_palette(load);
load_GL_OES_query_matrix(load);
return GLVersion.major != 0 || GLVersion.minor != 0;
}

View file

@ -31,12 +31,22 @@
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
#ifdef YQ2_GL1_GLES
#include "../glad-gles1/include/glad/glad.h"
#endif
#include "../../ref_shared.h" #include "../../ref_shared.h"
#include "qgl.h" #include "qgl.h"
#ifdef YQ2_GL1_GLES
#define REF_VERSION "Yamagi Quake II OpenGL ES1 Refresher"
#define GL_COLOR_INDEX GL_RGBA
#define GL_COLOR_INDEX8_EXT GL_RGBA
#else
#define REF_VERSION "Yamagi Quake II OpenGL Refresher"
#ifndef GL_COLOR_INDEX8_EXT #ifndef GL_COLOR_INDEX8_EXT
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX #define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif
#endif #endif
#define MAX_LIGHTMAPS 128 #define MAX_LIGHTMAPS 128
@ -47,7 +57,6 @@
#define MAX_GLTEXTURES 1024 #define MAX_GLTEXTURES 1024
#define BLOCK_WIDTH 128 // default values; now defined in glstate_t #define BLOCK_WIDTH 128 // default values; now defined in glstate_t
#define BLOCK_HEIGHT 128 #define BLOCK_HEIGHT 128
#define REF_VERSION "Yamagi Quake II OpenGL Refresher"
#define BACKFACE_EPSILON 0.01 #define BACKFACE_EPSILON 0.01
#define LIGHTMAP_BYTES 4 #define LIGHTMAP_BYTES 4
#define MAX_TEXTURE_UNITS 2 #define MAX_TEXTURE_UNITS 2
@ -337,6 +346,12 @@ void R_Buffer2DQuad(GLfloat ul_vx, GLfloat ul_vy, GLfloat dr_vx, GLfloat dr_vy,
GLfloat ul_tx, GLfloat ul_ty, GLfloat dr_tx, GLfloat dr_ty); GLfloat ul_tx, GLfloat ul_ty, GLfloat dr_tx, GLfloat dr_ty);
void R_SetBufferIndices(GLenum type, GLuint vertices_num); void R_SetBufferIndices(GLenum type, GLuint vertices_num);
#ifdef YQ2_GL1_GLES
#define glPolygonMode(...)
#define glFrustum(...) glFrustumf(__VA_ARGS__)
#define glDepthRange(...) glDepthRangef(__VA_ARGS__)
#define glOrtho(...) glOrthof(__VA_ARGS__)
#else
#ifdef DEBUG #ifdef DEBUG
void glCheckError_(const char *file, const char *function, int line); void glCheckError_(const char *file, const char *function, int line);
// Ideally, the following list should contain all OpenGL calls. // Ideally, the following list should contain all OpenGL calls.
@ -386,6 +401,7 @@ void glCheckError_(const char *file, const char *function, int line);
#define glBegin(...) glBegin(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__) #define glBegin(...) glBegin(__VA_ARGS__); glCheckError_(__FILE__, __func__, __LINE__)
#define glEnd() glEnd(); glCheckError_(__FILE__, __func__, __LINE__) #define glEnd() glEnd(); glCheckError_(__FILE__, __func__, __LINE__)
#endif #endif
#endif
/* GL extension emulation functions */ /* GL extension emulation functions */
void R_DrawParticles2(int n, void R_DrawParticles2(int n,

View file

@ -35,10 +35,17 @@
#if defined(__APPLE__) #if defined(__APPLE__)
#define GL_SILENCE_DEPRECATION #define GL_SILENCE_DEPRECATION
#endif
#ifdef YQ2_GL1_GLES
#include <GLES/gl.h>
#else
#if defined(__APPLE__)
#include <OpenGL/gl.h> #include <OpenGL/gl.h>
#else #else
#include <GL/gl.h> #include <GL/gl.h>
#endif #endif
#endif
#ifndef APIENTRY #ifndef APIENTRY
#define APIENTRY #define APIENTRY