The Android/Quest CMakeLists.txt patch previously reimplemented desktop
build / build (push) Successful in 1m8s

immediate-mode GL (glBegin/glVertex3f/glEnd and friends) from scratch on
top of GLES, since GLES has none of it. That code compiled but was never
actually exercised - no on-screen verification was possible without real
Quest hardware - making it the biggest unverified risk in the port.

Replace it with GL4ES (MIT-licensed, prebuilt into the build image),
a mature desktop-GL-on-GLES translation library used by other
Quest/Android game ports for exactly this problem. This cuts
04-android-opengl-es-render.patch by half, deleting the hand-written
vertex-accumulation emulation entirely; alpha test, point sprites, and
point size stay on their existing GLES-native fixes rather than trusting
GL4ES's shakier custom-shader interop for those.

Bump build-image/VERSION to 3 - a fresh image with GL4ES cross-compiled
for arm64-v8a was built and make apk verified successfully against it.
This commit is contained in:
ml
2026-07-20 12:52:34 +02:00
parent 9e2c9ffbe6
commit 66f02a0c61
8 changed files with 75 additions and 3258 deletions
@@ -1,17 +1,19 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,9 +46,15 @@
@@ -46,9 +46,17 @@
add_compile_options(-fsigned-char -fno-strict-aliasing)
-# Find OpenGL
+# Find OpenGL. Android has no desktop GL/GLX for CMake's FindOpenGL module
+# to find - just link the NDK's own GLESv2/EGL libraries directly.
+# to find - link the prebuilt GL4ES instead (translates this file's
+# desktop-style GL calls into GLES/EGL; it links GLESv2/EGL itself, so
+# the engine doesn't need to link them directly).
if(ENABLE_OPENGL)
- find_package(OpenGL REQUIRED)
+ if(ANDROID)
+ set(OPENGL_INCLUDE_DIRS "")
+ set(OPENGL_LIBRARIES GLESv2 EGL)
+ set(OPENGL_INCLUDE_DIRS /opt/prebuilt/android/gl4es/include)
+ set(OPENGL_LIBRARIES /opt/prebuilt/android/gl4es/lib/libGL.so)
+ else()
+ find_package(OpenGL REQUIRED)
+ endif()