libgoatvr

diff src/vr_libovr.c @ 30:1a8343ea54ce

fixed on windows
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 11 Apr 2015 04:01:47 +0300
parents ddaa9c764030
children
line diff
     1.1 --- a/src/vr_libovr.c	Wed Apr 08 02:32:22 2015 +0300
     1.2 +++ b/src/vr_libovr.c	Sat Apr 11 04:01:47 2015 +0300
     1.3 @@ -13,20 +13,13 @@
     1.4  #include <stdlib.h>
     1.5  #include <string.h>
     1.6  #include <assert.h>
     1.7 +#include "opengl.h"
     1.8  #include "opt.h"
     1.9  
    1.10  #include <OVR_CAPI.h>
    1.11  #include <OVR_CAPI_GL.h>
    1.12  
    1.13 -#ifdef OVR_OS_LINUX
    1.14 -#include <GL/glx.h>
    1.15 -#endif
    1.16 -
    1.17 -/* undef this if you want the retarded health and safety warning screen */
    1.18 -#undef DISABLE_RETARDED_HEALTH_WARNING
    1.19 -
    1.20 -/* just dropping the prototype here to avoid including CAPI_HSWDisplay.h */
    1.21 -OVR_EXPORT void ovrhmd_EnableHSWDisplaySDKRender(ovrHmd hmd, ovrBool enabled);
    1.22 +static PFNGLUSEPROGRAMPROC gl_use_program;
    1.23  
    1.24  static ovrHmd hmd;
    1.25  static void *optdb;
    1.26 @@ -111,6 +104,10 @@
    1.27  		set_option_int(optdb, VR_WIN_YOFFS, hmd->WindowsPos.y);
    1.28  	}
    1.29  
    1.30 +	if(!(gl_use_program = (PFNGLUSEPROGRAMPROC)vrimp_glfunc("glUseProgram"))) {
    1.31 +		gl_use_program = (PFNGLUSEPROGRAMPROC)vrimp_glfunc("glUseProgramObjectARB");
    1.32 +	}
    1.33 +
    1.34  	deferred_init_done = 0;
    1.35  	return 0;
    1.36  }
    1.37 @@ -177,11 +174,6 @@
    1.38  		set_option_vec(optdb, VR_LEYE_OFFSET, leye_offs);
    1.39  		set_option_vec(optdb, VR_REYE_OFFSET, reye_offs);
    1.40  	}
    1.41 -
    1.42 -
    1.43 -#ifdef DISABLE_RETARDED_HEALTH_WARNING
    1.44 -	ovrhmd_EnableHSWDisplaySDKRender(hmd, 0);
    1.45 -#endif
    1.46  }
    1.47  
    1.48  static void cleanup(void)
    1.49 @@ -314,17 +306,19 @@
    1.50  
    1.51  static int present(void)
    1.52  {
    1.53 -	int cur_prog;
    1.54 +	int cur_prog = 0;
    1.55  
    1.56  	if(!hmd) return 0;
    1.57  
    1.58 -	glGetIntegerv(GL_CURRENT_PROGRAM, &cur_prog);
    1.59 +	if(gl_use_program) {
    1.60 +		glGetIntegerv(GL_CURRENT_PROGRAM, &cur_prog);
    1.61 +	}
    1.62  
    1.63  	ovrHmd_EndFrame(hmd, pose, &eye_tex[0].Texture);
    1.64  	inside_begin_end = 0;
    1.65  
    1.66 -	if(cur_prog) {
    1.67 -		/*glUseProgram(0);*/
    1.68 +	if(gl_use_program) {
    1.69 +		gl_use_program(cur_prog);
    1.70  	}
    1.71  
    1.72  	return 1;