OpenXR recenter after the first frame

This commit is contained in:
Lubos 2022-05-11 16:11:54 +02:00
parent 5ecbbac97e
commit 5068ce7199
1 changed files with 7 additions and 0 deletions

View File

@ -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;
}
}