OpenXR recenter after the first frame

This commit is contained in:
Lubos 2022-05-11 16:11:54 +02:00
parent 5ecbbac97e
commit 5068ce7199

View file

@ -24,6 +24,7 @@ extern cvar_t *vr_heightAdjust;
XrView* projections; XrView* projections;
GLboolean stageSupported = GL_FALSE; GLboolean stageSupported = GL_FALSE;
GLboolean needRecenter = GL_FALSE;
void VR_UpdateStageBounds(ovrApp* pappState) { void VR_UpdateStageBounds(ovrApp* pappState) {
XrExtent2Df stageBounds = {}; XrExtent2Df stageBounds = {};
@ -287,6 +288,7 @@ void VR_InitRenderer( engine_t* engine ) {
if (engine->appState.CurrentSpace == XR_NULL_HANDLE) { if (engine->appState.CurrentSpace == XR_NULL_HANDLE) {
VR_Recenter(engine); VR_Recenter(engine);
needRecenter = GL_TRUE;
} }
projections = (XrView*)(malloc(ovrMaxNumEyes * sizeof(XrView))); projections = (XrView*)(malloc(ovrMaxNumEyes * sizeof(XrView)));
@ -534,4 +536,9 @@ void VR_DrawFrame( engine_t* engine ) {
OXR(xrEndFrame(engine->appState.Session, &endFrameInfo)); OXR(xrEndFrame(engine->appState.Session, &endFrameInfo));
frameBuffer->TextureSwapChainIndex++; frameBuffer->TextureSwapChainIndex++;
frameBuffer->TextureSwapChainIndex %= frameBuffer->TextureSwapChainLength; frameBuffer->TextureSwapChainIndex %= frameBuffer->TextureSwapChainLength;
if (needRecenter) {
VR_Recenter(engine);
needRecenter = GL_FALSE;
}
} }