Add OpenXR bring-up: render the game as a floating quad in an immersive Quest session
build / build (push) Successful in 2m12s
build / build (push) Successful in 2m12s
- New android/app/src/main/cpp/xr_session.c (+.h): owns the OpenXR
instance/session/local-space/swapchain and the per-frame
xrWaitFrame/xrBeginFrame/xrEndFrame loop, submitting the game's
existing flat render as a single head-tracked XrCompositionLayerQuad.
No stereo rendering or controller input yet - that's steps B/C/D of
the plan.
- 11-android-openxr-cmake.patch: links the OpenXR loader as a build
dependency, staged into jniLibs the same way as gl4es/SDL2.
build-image/Dockerfile and prepare-android-project.sh build and stage
it.
- 12-android-openxr-present.patch: redirects OpenGL.cc's final present
step (opengl_swap_and_restore / SDLDraw's software path) into the XR
swapchain FBO instead of the window, on Android only. Two real gl4es
bugs had to be worked around to get pixels on screen at all:
- gl4es's own glBindFramebuffer errors on an FBO id it didn't create
itself, even though the real driver-level bind succeeds - fixed by
creating the swapchain FBO container via gl4es's own
glGenFramebuffers/glBindFramebuffer, and only using the real
(dlsym'd) driver call for attaching OpenXR's foreign swapchain
texture, which gl4es's own attach can't handle.
- gl4es's glBegin/glVertexAttrib/glVertex3f immediate-mode emulation
only captures a fresh per-vertex value for attribute 0 (position,
driven directly by glVertex3f) - custom attributes like this
shader's texcoords/light are GLES2's *constant*-attribute API and
applied once for the whole draw, not per vertex, silently
collapsing the UI-overlay quad to a single sampled texel. Fixed by
switching that one draw call to real vertex arrays
(glVertexAttribPointer/glDrawArrays).
Also flips the V texcoord to match SDL's top-down row order against
GL's texture convention, and reuses a persistent texture object
instead of a fresh gen/upload/delete every frame.
- AndroidManifest.xml: declares the immersive-HMD intent category and
focus-aware metadata, drops the 2D-panel layout hint.
- README: documents the new OpenXR immersive mode.
This commit is contained in:
@@ -6,6 +6,16 @@ An open source project to play the classic 1994 System Shock on a VR
|
||||
headset, built on top of [Shockolate](https://github.com/Interrupt/systemshock),
|
||||
a cross-platform port of the original game.
|
||||
|
||||
## Design principles
|
||||
|
||||
- **Standalone-headset-only.** The game must run entirely on the headset
|
||||
itself - no PC required, whether tethered or streamed (not PCVR). Any
|
||||
feature or dependency that assumes a host PC is out of scope.
|
||||
- **OpenXR-first.** Favor OpenXR-standard APIs over vendor-specific ones
|
||||
(e.g. Meta's Oculus Mobile SDK) wherever there's a choice, so the port
|
||||
isn't locked to Meta Quest and can work across other standalone,
|
||||
Android-based OpenXR headsets (e.g. Pico) too.
|
||||
|
||||
## Layout
|
||||
|
||||
- `engine/` - a vendored snapshot of the Shockolate engine source. Built
|
||||
@@ -88,11 +98,14 @@ resulting tarball to dl.ladkau.de.
|
||||
|
||||
## Playing on Meta Quest
|
||||
|
||||
`make apk` builds `dist/questshock-<version>-android-arm64.apk` - a plain
|
||||
(non-VR) Android app that runs as a flat, floating panel in the Quest's
|
||||
Home environment, same as any other sideloaded Android app. It's not a
|
||||
head-tracked 6DoF VR port (that's a much larger, separate undertaking);
|
||||
play with a Bluetooth mouse/keyboard connected to the headset.
|
||||
`make apk` builds `dist/questshock-<version>-android-arm64.apk` - an
|
||||
immersive OpenXR app (see `android/app/src/main/cpp/xr_session.c`): the
|
||||
game's own rendering is unchanged (still a flat, 2D render, no stereo 3D
|
||||
scene), but instead of running as a Home-hosted 2D panel it's now shown as
|
||||
a single head-tracked quad floating in front of the viewer in an otherwise
|
||||
empty space. There's no controller-driven interaction yet (that's ongoing
|
||||
work - a laser-pointer-driven menu and on-screen keyboard); for now, play
|
||||
with a Bluetooth mouse/keyboard connected to the headset same as before.
|
||||
|
||||
1. Install the APK with [SideQuest](https://sidequestvr.com/) (or `adb
|
||||
install`).
|
||||
@@ -121,7 +134,7 @@ To have Android Studio compile and deploy `android/` itself instead:
|
||||
```
|
||||
|
||||
This stages everything `make apk` normally stages (a scratch, patched
|
||||
copy of `engine/`; the Android SDL2/SDL2_mixer/fluidsynth-lite/gl4es
|
||||
copy of `engine/`; the Android SDL2/SDL2_mixer/fluidsynth-lite/gl4es/openxr
|
||||
prebuilts; bundled assets) - the same as `build-apk.sh`'s own prep step -
|
||||
except it writes `android/engine.properties` with paths that resolve on
|
||||
your host filesystem, and additionally exports the prebuilt libraries
|
||||
@@ -151,6 +164,10 @@ The Quest build also bundles [GL4ES](https://github.com/ptitSeb/gl4es)
|
||||
image), which translates the engine's desktop-style OpenGL calls into
|
||||
GLES/EGL and is MIT-licensed.
|
||||
|
||||
It also bundles the Khronos Group's own [OpenXR-SDK loader](
|
||||
https://github.com/KhronosGroup/OpenXR-SDK) (`lib/arm64-v8a/libopenxr_loader.so`,
|
||||
prebuilt unmodified into the build image), which is Apache 2.0-licensed.
|
||||
|
||||
The vendored engine snapshot in `engine/` is
|
||||
[Shockolate](https://github.com/Interrupt/systemshock), which is licensed
|
||||
under the **GNU GPLv3** (see `engine/LICENSE`) - it is included unchanged
|
||||
|
||||
Reference in New Issue
Block a user