# HG changeset patch # User John Tsiombikas # Date 1421039799 -7200 # Node ID 7f9cc8a4d3a560faf8d87a5defb2633026bb7007 # Parent 827ec716c275fb200e08783332d0bda899f1cdbf ported the libovr backend to 0.4.4 diff -r 827ec716c275 -r 7f9cc8a4d3a5 src/vr_libovr.c --- a/src/vr_libovr.c Sat Oct 11 07:18:07 2014 +0300 +++ b/src/vr_libovr.c Mon Jan 12 07:16:39 2015 +0200 @@ -119,7 +119,7 @@ memset(&glcfg, 0, sizeof glcfg); glcfg.OGL.Header.API = ovrRenderAPI_OpenGL; - glcfg.OGL.Header.RTSize = hmd->Resolution; + glcfg.OGL.Header.BackBufferSize = hmd->Resolution; glcfg.OGL.Header.Multisample = 1; #ifdef WIN32 win = GetActiveWindow(); @@ -137,7 +137,7 @@ } ovrHmd_SetEnabledCaps(hmd, ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction); - dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp | + dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_TimeWarp | ovrDistortionCap_Overdrive | ovrDistortionCap_NoRestore; if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, dcaps, eye_fov, eye_render_desc)) { @@ -145,13 +145,13 @@ } /* set the eye offset options */ - leye_offs[0] = eye_render_desc[ovrEye_Left].ViewAdjust.x; - leye_offs[1] = eye_render_desc[ovrEye_Left].ViewAdjust.y; - leye_offs[2] = eye_render_desc[ovrEye_Left].ViewAdjust.z; + leye_offs[0] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.x; + leye_offs[1] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.y; + leye_offs[2] = eye_render_desc[ovrEye_Left].HmdToEyeViewOffset.z; set_option_vec(optdb, VR_LEYE_OFFSET, leye_offs); - reye_offs[0] = eye_render_desc[ovrEye_Right].ViewAdjust.x; - reye_offs[1] = eye_render_desc[ovrEye_Right].ViewAdjust.y; - reye_offs[2] = eye_render_desc[ovrEye_Right].ViewAdjust.z; + reye_offs[0] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.x; + reye_offs[1] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.y; + reye_offs[2] = eye_render_desc[ovrEye_Right].HmdToEyeViewOffset.z; set_option_vec(optdb, VR_REYE_OFFSET, reye_offs); #ifdef DISABLE_RETARDED_HEALTH_WARNING @@ -219,7 +219,7 @@ * reuse the one we got last frame. */ if(inside_begin_end) { - pose[eye] = ovrHmd_GetEyePose(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right); + pose[eye] = ovrHmd_GetHmdPosePerEye(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right); } vec[0] = pose[eye].Position.x; @@ -237,7 +237,7 @@ /* same as above (translation) */ if(inside_begin_end) { - pose[eye] = ovrHmd_GetEyePose(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right); + pose[eye] = ovrHmd_GetHmdPosePerEye(hmd, eye == VR_EYE_LEFT ? ovrEye_Left : ovrEye_Right); } quat[0] = pose[eye].Orientation.x; @@ -301,7 +301,7 @@ glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texsz.h); rect.Pos.x = (int)(umin * texsz.w); - rect.Pos.y = (int)((vmin + 1.0 - vmax) * texsz.h); + rect.Pos.y = (int)(vmin * texsz.h); rect.Size.w = (int)((umax - umin) * texsz.w); rect.Size.h = (int)((vmax - vmin) * texsz.h);