# HG changeset patch # User John Tsiombikas # Date 1414256875 -10800 # Node ID 9c36ae39ad958ded79f4cd13059065176edafb7d # Parent 4d6733229e010e8b03894b474d037c51265a2284# Parent 5b04743fd3d0da414bfdeeac4a222314acbd2a32 merged diff -r 4d6733229e01 -r 9c36ae39ad95 src/main.c --- a/src/main.c Sat Oct 25 20:07:24 2014 +0300 +++ b/src/main.c Sat Oct 25 20:07:55 2014 +0300 @@ -1,5 +1,7 @@ /* Very simple OculusSDK OpenGL usage example. - * Uses SDL2 for event handling and OpenGL context management. + * + * Uses SDL2 (www.libsdl.org) for event handling and OpenGL context management. + * Uses GLEW (glew.sourceforge.net) for OpenGL extension wrangling. * * Author: John Tsiombikas * This code is in the public domain. Do whatever you like with it. @@ -154,7 +156,7 @@ * XXX: this doesn't work properly yet due to bugs in the oculus 0.4.1 sdk/driver */ #ifdef WIN32 - void *sys_win = GetActiveWindow(); + HWND sys_win = GetActiveWindow(); glcfg.OGL.Window = sys_win; glcfg.OGL.DC = wglGetCurrentDC(); ovrHmd_AttachToWindow(hmd, sys_win, 0, 0); @@ -169,7 +171,8 @@ * timewrap, which shifts the image before drawing to counter any lattency between the call * to ovrHmd_GetEyePose and ovrHmd_EndFrame. */ - dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp; + dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp | + ovrDistortionCap_Overdrive; if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, dcaps, hmd->DefaultEyeFov, eye_rdesc)) { fprintf(stderr, "failed to configure distortion renderer\n"); } @@ -235,14 +238,14 @@ /* for each eye ... */ for(i=0; i<2; i++) { - int eye = hmd->EyeRenderOrder[i]; + ovrEyeType eye = hmd->EyeRenderOrder[i]; /* -- viewport transformation -- * setup the viewport to draw in the left half of the framebuffer when we're * rendering the left eye's view (0, 0, width/2, height), and in the right half * of the framebuffer for the right eye's view (width/2, 0, width/2, height) */ - glViewport(eye == 0 ? 0 : fb_width / 2, 0, fb_width / 2, fb_height); + glViewport(eye == ovrEye_Left ? 0 : fb_width / 2, 0, fb_width / 2, fb_height); /* -- projection transformation -- * we'll just have to use the projection matrix supplied by the oculus SDK for this eye