oculus1

diff src/vr.cc @ 14:cceffea995a4

implemented wasd controls and clamping of the texcoords to [0, 1]
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 21 Sep 2013 03:35:53 +0300
parents 464e1d135d68
children 402cbb6d9ce3
line diff
     1.1 --- a/src/vr.cc	Sat Sep 21 03:00:47 2013 +0300
     1.2 +++ b/src/vr.cc	Sat Sep 21 03:35:53 2013 +0300
     1.3 @@ -107,7 +107,13 @@
     1.4  			vr_ctx.info.distort[i] = info.DistortionK[i];
     1.5  		}
     1.6  
     1.7 -		vr_ctx.info.scale = 1.0;
     1.8 +		Util::Render::StereoConfig stereohelp;
     1.9 +		stereohelp.SetFullViewport(Util::Render::Viewport(0, 0, vr_ctx.info.width, vr_ctx.info.height));
    1.10 +		stereohelp.SetStereoMode(Util::Render::Stereo_LeftRight_Multipass);
    1.11 +		stereohelp.SetHMDInfo(info);
    1.12 +		stereohelp.SetDistortionFitPointVP(-1.0, 0.0);
    1.13 +
    1.14 +		vr_ctx.info.scale = stereohelp.GetDistortionScale();
    1.15  
    1.16  		float vhalfsz = vr_ctx.info.scale * info.VScreenSize * 0.5;
    1.17  		vr_ctx.info.fov = 2.0 * atan(vhalfsz / info.EyeToScreenDistance);
    1.18 @@ -173,6 +179,16 @@
    1.19  	glGetShaderiv(sdr, GL_COMPILE_STATUS, &status);
    1.20  	if(!status) {
    1.21  		fprintf(stderr, "failed to compile distortion shader\n");
    1.22 +
    1.23 +		int loglen;
    1.24 +		glGetShaderiv(sdr, GL_INFO_LOG_LENGTH, &loglen);
    1.25 +
    1.26 +		if(loglen > 0) {
    1.27 +			char *log = (char*)alloca(loglen);
    1.28 +			glGetShaderInfoLog(sdr, loglen, &loglen, log);
    1.29 +			fprintf(stderr, "%s\n", log);
    1.30 +		}
    1.31 +
    1.32  		return false;
    1.33  	}
    1.34