Files
questshock/android/engine-patches/02-android-opengl-es.patch
ml d2dc58391b
build / build (push) Successful in 2m26s
Add controller input and a laser-pointer-driven menu quad
- xr_input.c/h: an OpenXR action set (aim pose, trigger/select click, a
  menu-toggle button) plus ray/quad hit-testing, and a visible
  laser-pointer line drawn from the controller toward the hit point.
- xr_menu.c/h + MenuOverlay.java: a second composition-layer quad,
  toggled by a controller button, showing an off-screen, never-attached
  Android View tree (one "Keyboard" button so far) driven by synthetic
  touch events computed from the laser ray's hit UV.
- Migrate gl4es from a prebuilt binary baked into the Docker build-image
  to a vendored source snapshot (android/gl4es-src/) compiled from
  source at APK build time via CMake add_subdirectory(), patched through
  a new android/gl4es-patches/ (mirrors the existing engine-patches/
  pattern). This was needed to track down and fix a bug hit while
  building the menu: gl4es's fixed-pipeline emulation (fpe.c) was
  unconditionally substituting its own shader onto the menu's draw call
  (fpe_ReleventState() always sets alphafunc to a nonzero sentinel, so
  its fpe_IsEmpty() check could never see the state as empty), making
  the menu quad show the game's own rendering instead of its own
  content. Fixed by routing the menu's blit through a real
  glBlitFramebuffer() call instead of a shader-based draw, which gl4es's
  fpe.c has nothing to intercept - documented in README.md's new
  "Debugging notes" section.
- Renumber android/engine-patches/ to close the gap left by removing an
  unrelated diagnostic-only patch, and strip investigation-journal
  comments and dead diagnostic code (temporary tracing, env-var probes)
  left over from finding the bug above.
- Restructure README.md into numbered sections, document every
  engine/gl4es patch, add Android Studio dev/testing-cycle instructions,
  and generalize Quest-specific wording to any OpenXR headset. Update
  NOTICE.txt to match (gl4es is now vendored/patched source, not a
  prebuilt binary; add the OpenXR-SDK loader).
2026-08-02 06:27:49 +02:00

34 lines
1.5 KiB
Diff

diff -ru a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt 2026-07-31 14:04:53.195646458 +0200
+++ b/CMakeLists.txt 2026-07-31 14:05:05.703429751 +0200
@@ -46,9 +46,27 @@
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 - build GL4ES from source 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), via add_subdirectory
+# rather than a prebuilt .so: ANDROID_GL4ES_DIR (passed in by
+# android/app/build.gradle, same as ANDROID_PREBUILT_DIR) is a scratch,
+# patched copy of android/gl4es-src/ staged by
+# build-image/prepare-android-project.sh (mirrors how this file itself is
+# staged/patched before Gradle ever sees it) - building it as part of this
+# same CMake configure means Gradle's own incremental CMake/Ninja build
+# only recompiles it when gl4es-src/gl4es-patches actually changed, same
+# as this file, instead of needing a full build-image rebuild for every
+# gl4es-patches change.
if(ENABLE_OPENGL)
- find_package(OpenGL REQUIRED)
+ if(ANDROID)
+ add_subdirectory(${ANDROID_GL4ES_DIR} ${CMAKE_BINARY_DIR}/gl4es-build)
+ set(OPENGL_INCLUDE_DIRS ${ANDROID_GL4ES_DIR}/include)
+ set(OPENGL_LIBRARIES GL)
+ 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)