oculus2

changeset 9:9c36ae39ad95

merged
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Oct 2014 20:07:55 +0300
parents 4d6733229e01 5b04743fd3d0
children 3d224ad45cac
files src/main.c
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line diff
     1.1 --- a/src/main.c	Sat Oct 25 20:07:24 2014 +0300
     1.2 +++ b/src/main.c	Sat Oct 25 20:07:55 2014 +0300
     1.3 @@ -1,5 +1,7 @@
     1.4  /* Very simple OculusSDK OpenGL usage example.
     1.5 - * Uses SDL2 for event handling and OpenGL context management.
     1.6 + *
     1.7 + * Uses SDL2 (www.libsdl.org) for event handling and OpenGL context management.
     1.8 + * Uses GLEW (glew.sourceforge.net) for OpenGL extension wrangling.
     1.9   *
    1.10   * Author: John Tsiombikas <nuclear@member.fsf.org>
    1.11   * This code is in the public domain. Do whatever you like with it.
    1.12 @@ -154,7 +156,7 @@
    1.13  		 * XXX: this doesn't work properly yet due to bugs in the oculus 0.4.1 sdk/driver
    1.14  		 */
    1.15  #ifdef WIN32
    1.16 -		void *sys_win = GetActiveWindow();
    1.17 +		HWND sys_win = GetActiveWindow();
    1.18  		glcfg.OGL.Window = sys_win;
    1.19  		glcfg.OGL.DC = wglGetCurrentDC();
    1.20  		ovrHmd_AttachToWindow(hmd, sys_win, 0, 0);
    1.21 @@ -169,7 +171,8 @@
    1.22  	 * timewrap, which shifts the image before drawing to counter any lattency between the call
    1.23  	 * to ovrHmd_GetEyePose and ovrHmd_EndFrame.
    1.24  	 */
    1.25 -	dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp;
    1.26 +	dcaps = ovrDistortionCap_Chromatic | ovrDistortionCap_Vignette | ovrDistortionCap_TimeWarp |
    1.27 +		ovrDistortionCap_Overdrive;
    1.28  	if(!ovrHmd_ConfigureRendering(hmd, &glcfg.Config, dcaps, hmd->DefaultEyeFov, eye_rdesc)) {
    1.29  		fprintf(stderr, "failed to configure distortion renderer\n");
    1.30  	}
    1.31 @@ -235,14 +238,14 @@
    1.32  
    1.33  	/* for each eye ... */
    1.34  	for(i=0; i<2; i++) {
    1.35 -		int eye = hmd->EyeRenderOrder[i];
    1.36 +		ovrEyeType eye = hmd->EyeRenderOrder[i];
    1.37  
    1.38  		/* -- viewport transformation --
    1.39  		 * setup the viewport to draw in the left half of the framebuffer when we're
    1.40  		 * rendering the left eye's view (0, 0, width/2, height), and in the right half
    1.41  		 * of the framebuffer for the right eye's view (width/2, 0, width/2, height)
    1.42  		 */
    1.43 -		glViewport(eye == 0 ? 0 : fb_width / 2, 0, fb_width / 2, fb_height);
    1.44 +		glViewport(eye == ovrEye_Left ? 0 : fb_width / 2, 0, fb_width / 2, fb_height);
    1.45  
    1.46  		/* -- projection transformation --
    1.47  		 * we'll just have to use the projection matrix supplied by the oculus SDK for this eye