conworlds
diff src/vr/vr_libovr.c @ 9:c2eecf764daa
foo
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Fri, 22 Aug 2014 18:48:25 +0300 |
parents | 90abf4b93cc9 |
children | e3f0ca1d008a |
line diff
1.1 --- a/src/vr/vr_libovr.c Fri Aug 22 17:24:43 2014 +0300 1.2 +++ b/src/vr/vr_libovr.c Fri Aug 22 18:48:25 2014 +0300 1.3 @@ -86,6 +86,7 @@ 1.4 { 1.5 union ovrGLConfig glcfg; 1.6 unsigned int dcaps; 1.7 + void *win = 0; 1.8 1.9 deferred_init_done = 1; 1.10 1.11 @@ -93,22 +94,26 @@ 1.12 1.13 glcfg.OGL.Header.API = ovrRenderAPI_OpenGL; 1.14 glcfg.OGL.Header.RTSize = hmd->Resolution; 1.15 - glcfg.OGL.Header.Multisample = 0; 1.16 + glcfg.OGL.Header.Multisample = 1; 1.17 #ifdef WIN32 1.18 - glcfg.OGL.Window = GetActiveWindow(); 1.19 + win = GetActiveWindow(); 1.20 + glcfg.OGL.Window = win; 1.21 glcfg.OGL.DC = wglGetCurrentDC(); 1.22 - ovrHmd_AttachToWindow(hmd, glcfg.OGL.Window, 0, 0); 1.23 assert(glcfg.OGL.Window); 1.24 + assert(glcfg.OGL.DC); 1.25 #endif 1.26 1.27 - dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp | 1.28 - ovrDistortionCap_Overdrive | ovrDistortionCap_FlipInput; 1.29 + ovrHmd_AttachToWindow(hmd, win, 0, 0); 1.30 + //ovrHmd_SetEnabledCaps(hmd, ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction); 1.31 + 1.32 + dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette;// | ovrDistortionCap_TimeWarp;// | 1.33 + //ovrDistortionCap_Overdrive; 1.34 1.35 if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, dcaps, eye_fov, eye_render_desc)) { 1.36 fprintf(stderr, "failed to configure LibOVR distortion renderer\n"); 1.37 } 1.38 1.39 - ovrhmd_EnableHSWDisplaySDKRender(hmd, 0); 1.40 + //ovrhmd_EnableHSWDisplaySDKRender(hmd, 0); 1.41 } 1.42 1.43 static void cleanup(void) 1.44 @@ -207,7 +212,9 @@ 1.45 1.46 static int present(void) 1.47 { 1.48 - if(!hmd) return; 1.49 + if(!hmd) return 0; 1.50 + 1.51 + glDisable(GL_DEPTH_TEST); 1.52 1.53 ovrHmd_EndFrame(hmd, pose, &eye_tex[0].Texture); 1.54 new_frame = 1; 1.55 @@ -229,6 +236,9 @@ 1.56 rect.Size.w = (int)((umax - umin) * texsz.w); 1.57 rect.Size.h = (int)((vmax - vmin) * texsz.h); 1.58 1.59 + printf("eye %d texture: %u [%g, %g] -> [%g, %g]\n", eye, tex, umin, vmin, umax, vmax); 1.60 + printf(" pixels [%d, %d] -> [%d, %d]\n", rect.Pos.x, rect.Pos.y, rect.Pos.x + rect.Size.w, rect.Pos.y + rect.Size.h); 1.61 + 1.62 eye_tex[eye].OGL.Header.API = ovrRenderAPI_OpenGL; 1.63 eye_tex[eye].OGL.Header.TextureSize = texsz; 1.64 eye_tex[eye].OGL.Header.RenderViewport = rect;