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
+21
View File
@@ -46,6 +46,10 @@ ARG ANDROID_COMPILE_SDK_VERSION=34
ARG ANDROID_BUILD_TOOLS_VERSION=34.0.0
ARG ANDROID_NDK_VERSION=26.1.10909125
ARG ANDROID_CMAKE_VERSION=3.22.1
# GL4ES (https://github.com/ptitSeb/gl4es) - translates the engine's
# desktop-style immediate-mode OpenGL calls into real GLES/EGL calls, so
# engine/src/MacSrc/OpenGL.cc needs no immediate-mode rewrite on Android.
ARG ANDROID_GL4ES_VERSION=1.1.6
ENV DEBIAN_FRONTEND=noninteractive
@@ -225,6 +229,23 @@ RUN git clone https://github.com/EtherTyper/fluidsynth-lite.git fluidsynth-lite-
/opt/prebuilt/android/fluidsynth-lite/include/fluidsynth/version.h \
&& rm -rf fluidsynth-lite-android build-fluidsynth-android
# gl4es's own CMakeLists.txt writes its output straight to
# ${CMAKE_SOURCE_DIR}/lib (the source tree, not the build dir) and gives
# the GL target a ".so.1" suffix - stage explicitly rather than
# `cmake --install` (which it doesn't support for this target anyway).
RUN git clone --branch "v${ANDROID_GL4ES_VERSION}" --depth 1 \
https://github.com/ptitSeb/gl4es.git gl4es-android \
&& rm -rf gl4es-android/.git \
&& cmake -S gl4es-android -B build-gl4es-android \
-DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK_TOOLCHAIN}" \
-DANDROID_ABI="${ANDROID_ABI}" -DANDROID_PLATFORM="android-${ANDROID_PLATFORM_VERSION}" \
-DANDROID=ON -DUSE_ANDROID_LOG=ON -DSTATICLIB=OFF \
&& cmake --build build-gl4es-android -j"$(nproc)" \
&& mkdir -p /opt/prebuilt/android/gl4es/lib /opt/prebuilt/android/gl4es/include \
&& cp -a gl4es-android/lib/libGL.so.1 /opt/prebuilt/android/gl4es/lib/libGL.so \
&& cp -a gl4es-android/include/. /opt/prebuilt/android/gl4es/include/ \
&& rm -rf gl4es-android build-gl4es-android
COPY build-image/docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
COPY build-image/build-engine.sh /usr/local/bin/build-engine.sh
RUN chmod +x /usr/local/bin/docker-entrypoint.sh /usr/local/bin/build-engine.sh
+1 -1
View File
@@ -1 +1 @@
2
3
+2 -1
View File
@@ -42,11 +42,12 @@ cp -a "$ANDROID_DIR/gles-shaders/." "$ASSETS_DIR/shaders/"
cp "/opt/prebuilt/soundfont/default.sf2" "$ASSETS_DIR/res/soundfont.sf2"
cp "$REPO_ROOT/res/assets/GET_ASSETS_QUEST.txt" "$ASSETS_DIR/GET_ASSETS_QUEST.txt"
echo "== Staging prebuilt Android SDL2/SDL2_mixer/fluidsynth-lite .so's into jniLibs =="
echo "== Staging prebuilt Android SDL2/SDL2_mixer/fluidsynth-lite/gl4es .so's into jniLibs =="
JNI_LIBS_DIR="$ANDROID_DIR/app/src/main/jniLibs/arm64-v8a"
rm -rf "$ANDROID_DIR/app/src/main/jniLibs"
mkdir -p "$JNI_LIBS_DIR"
find /opt/prebuilt/android/sdl2/lib /opt/prebuilt/android/sdl2_mixer/lib /opt/prebuilt/android/fluidsynth-lite/lib \
/opt/prebuilt/android/gl4es/lib \
-name '*.so' -exec cp -a {} "$JNI_LIBS_DIR/" \;
echo "== Building the APK (gradlew assembleDebug) =="