Files
questshock/android/engine-patches/02-android-opengl-es.patch
T
ml 66f02a0c61
build / build (push) Successful in 1m8s
The Android/Quest CMakeLists.txt patch previously reimplemented desktop
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.
2026-07-20 12:52:34 +02:00

23 lines
779 B
Diff

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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 - 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 /opt/prebuilt/android/gl4es/include)
+ set(OPENGL_LIBRARIES /opt/prebuilt/android/gl4es/lib/libGL.so)
+ else()
+ find_package(OpenGL REQUIRED)
+ endif()
add_definitions(-DUSE_OPENGL)
if(WIN32)
list(APPEND OPENGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/build_ext/built_glew/include)