libgoatvr

diff src/vr.c @ 17:3de7339841d0

option for the null module fallback presentation to show one or both eye views
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 25 Sep 2014 17:14:04 +0300
parents b2d902fff68d
children 1067274dc780
line diff
     1.1 --- a/src/vr.c	Thu Sep 25 09:06:57 2014 +0300
     1.2 +++ b/src/vr.c	Thu Sep 25 17:14:04 2014 +0300
     1.3 @@ -39,6 +39,7 @@
     1.4  		set_option_float(defopt, VR_RENDER_RES_SCALE, 1.0);
     1.5  		set_option_float(defopt, VR_EYE_HEIGHT, 1.675);
     1.6  		set_option_float(defopt, VR_IPD, 0.064);
     1.7 +		set_option_int(defopt, VR_NULL_STEREO, 0);
     1.8  	}
     1.9  
    1.10  	if(vrm) {
    1.11 @@ -330,7 +331,7 @@
    1.12  
    1.13  static void fallback_present(void)
    1.14  {
    1.15 -	int i;
    1.16 +	int i, show_both = vr_geti(VR_NULL_STEREO);
    1.17  
    1.18  	glPushAttrib(GL_ENABLE_BIT | GL_TRANSFORM_BIT);
    1.19  
    1.20 @@ -350,8 +351,15 @@
    1.21  	glLoadIdentity();
    1.22  
    1.23  	for(i=0; i<2; i++) {
    1.24 -		float x0 = i == 0 ? -1 : 0;
    1.25 -		float x1 = i == 0 ? 0 : 1;
    1.26 +		float x0, x1;
    1.27 +
    1.28 +		if(show_both) {
    1.29 +			x0 = i == 0 ? -1 : 0;
    1.30 +			x1 = i == 0 ? 0 : 1;
    1.31 +		} else {
    1.32 +			x0 = -1;
    1.33 +			x1 = 1;
    1.34 +		}
    1.35  
    1.36  		glBindTexture(GL_TEXTURE_2D, rtarg[i].tex);
    1.37  
    1.38 @@ -365,6 +373,8 @@
    1.39  		glTexCoord2f(rtarg[i].umin, rtarg[i].vmax);
    1.40  		glVertex2f(x0, 1);
    1.41  		glEnd();
    1.42 +
    1.43 +		if(!show_both) break;
    1.44  	}
    1.45  
    1.46  	glPopMatrix();