move UI plane when toggled in VR, fix vr start/stop on Quest

This commit is contained in:
2019-06-01 22:59:45 +02:00
parent 78f453f89c
commit e5c7a35fd2
5 changed files with 52 additions and 16 deletions

View File

@@ -141,6 +141,22 @@ void oculus_init_vr(EGLDisplay display, EGLContext context, ANativeWindow* surfa
vrapi_SetPerfThread(ovr_context, VRAPI_PERF_THREAD_TYPE_RENDERER, 0);
}
void oculus_release_vr()
{
vrapi_LeaveVrMode(ovr_context);
ovr_context = nullptr;
for (int eye = 0; eye < 2; eye++)
{
vrapi_DestroyTextureSwapChain(swap_chain[eye]);
swap_chain[eye] = nullptr;
for (int i = 0; i < swap_chain_count; i++)
ovr_eyes[eye][i].destroy();
}
swap_chain_index = 0;
swap_chain_count = 0;
LOG("leave vr mode");
}
void oculus_draw(float dt)
{
const double predictedDisplayTime = vrapi_GetPredictedDisplayTime(ovr_context, ovr_frame);

View File

@@ -12,4 +12,5 @@
void oculus_init(JavaVM* vm, JNIEnv* jni, jobject activity_class);
void oculus_init_vr(EGLDisplay display, EGLContext context, ANativeWindow* surface);
void oculus_release_vr();
void oculus_draw(float dt);