diff --git a/android/app/src/main/cpp/code/vr/vr_renderer.c b/android/app/src/main/cpp/code/vr/vr_renderer.c index 5d73ab80..bf8bbd46 100644 --- a/android/app/src/main/cpp/code/vr/vr_renderer.c +++ b/android/app/src/main/cpp/code/vr/vr_renderer.c @@ -24,6 +24,7 @@ extern cvar_t *vr_heightAdjust; XrView* projections; GLboolean stageSupported = GL_FALSE; +GLboolean needRecenter = GL_FALSE; void VR_UpdateStageBounds(ovrApp* pappState) { XrExtent2Df stageBounds = {}; @@ -287,6 +288,7 @@ void VR_InitRenderer( engine_t* engine ) { if (engine->appState.CurrentSpace == XR_NULL_HANDLE) { VR_Recenter(engine); + needRecenter = GL_TRUE; } projections = (XrView*)(malloc(ovrMaxNumEyes * sizeof(XrView))); @@ -534,4 +536,9 @@ void VR_DrawFrame( engine_t* engine ) { OXR(xrEndFrame(engine->appState.Session, &endFrameInfo)); frameBuffer->TextureSwapChainIndex++; frameBuffer->TextureSwapChainIndex %= frameBuffer->TextureSwapChainLength; + + if (needRecenter) { + VR_Recenter(engine); + needRecenter = GL_FALSE; + } }