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:
@@ -12,6 +12,11 @@
|
||||
<!-- External mouse input events -->
|
||||
<uses-feature android:name="android.hardware.type.pc" android:required="false" />
|
||||
|
||||
<!-- Immersive OpenXR app now (see android/app/src/main/cpp/xr_session.c),
|
||||
not a 2D Home panel - vr.headtracking is what actually declares that
|
||||
to Horizon OS. -->
|
||||
<uses-feature android:name="android.hardware.vr.headtracking" android:version="1" android:required="true" />
|
||||
|
||||
<!-- Plain, unrestricted /sdcard access for the res/data,res/sound the
|
||||
user drops in and the shaders/soundfont this app extracts there on
|
||||
first run - see res/GET_ASSETS_QUEST.txt and QuestShockActivity.
|
||||
@@ -28,6 +33,11 @@
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:hardwareAccelerated="true" >
|
||||
|
||||
<!-- Tells Horizon OS this activity wants the compositor for itself
|
||||
(immersive VR), not the Home 2D-panel path - required for an
|
||||
OpenXR session to actually start. -->
|
||||
<meta-data android:name="com.oculus.vr.focusaware" android:value="true" />
|
||||
|
||||
<activity android:name="de.ladkau.questshock.QuestShockActivity"
|
||||
android:label="@string/app_name"
|
||||
android:alwaysRetainTaskState="true"
|
||||
@@ -40,23 +50,19 @@
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
<!-- The vendor-neutral, Khronos-defined way to declare an
|
||||
immersive OpenXR entry point (vs. e.g. Meta's own
|
||||
com.oculus.intent.category.VR) - see this project's
|
||||
"favor OpenXR" rule in the README. If Horizon OS still
|
||||
launches this as a flat panel on-device, the next thing
|
||||
to try is adding a com.oculus.supportedDevices meta-data
|
||||
listing the target Quest models - not confirmed
|
||||
necessary from static analysis alone. -->
|
||||
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
|
||||
</intent-filter>
|
||||
<!-- Without this, Quest's Home shell picks its own default 2D
|
||||
panel shape for this activity - a tall portrait rectangle,
|
||||
which crops a 4:3 landscape game like System Shock's classic
|
||||
640x480 down to a sliver. defaultWidth/defaultHeight (the
|
||||
standard Android multi-window sizing hint, which Quest's
|
||||
panel system honors for 2D apps) requests a properly
|
||||
landscape, 4:3-ish panel instead; minWidth/minHeight keep it
|
||||
from being resized below the game's native resolution. -->
|
||||
<layout android:defaultWidth="1280dp"
|
||||
android:defaultHeight="960dp"
|
||||
android:minWidth="640dp"
|
||||
android:minHeight="480dp"
|
||||
android:gravity="center" />
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user