conworlds

changeset 18:e4257df067a1

oh yeah, now the tracking is solid. Wasn't rendering the correct part of the texture before.
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 26 Aug 2014 12:59:15 +0300
parents 9b0db7dbde6e
children c5054e0cd564
files src/game.cc src/vr/vr_libovr.c
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line diff
     1.1 --- a/src/game.cc	Sun Aug 24 14:36:00 2014 +0300
     1.2 +++ b/src/game.cc	Tue Aug 26 12:59:15 2014 +0300
     1.3 @@ -147,11 +147,9 @@
     1.4  	if(eye == 0 || !vr_view_matrix(eye < 0 ? 0 : 1, mat)) {
     1.5  		glLoadIdentity();
     1.6  	} else {
     1.7 -		glLoadIdentity();
     1.8 -		//glLoadMatrixf(mat);
     1.9 +		glLoadMatrixf(mat);
    1.10  	}
    1.11  	glMultTransposeMatrixf(view_matrix[0]);
    1.12 -	glMultMatrixf(mat);
    1.13  
    1.14  	draw_scene();
    1.15  }
     2.1 --- a/src/vr/vr_libovr.c	Sun Aug 24 14:36:00 2014 +0300
     2.2 +++ b/src/vr/vr_libovr.c	Tue Aug 26 12:59:15 2014 +0300
     2.3 @@ -110,6 +110,9 @@
     2.4  
     2.5  	if(!(hmd->HmdCaps & ovrHmdCap_ExtendDesktop)) {
     2.6  		ovrHmd_AttachToWindow(hmd, win, 0, 0);
     2.7 +		printf("running in \"direct-to-rift\" mode\n");
     2.8 +	} else {
     2.9 +		printf("running in \"extended desktop\" mode\n");
    2.10  	}
    2.11  	ovrHmd_SetEnabledCaps(hmd, ovrHmdCap_LowPersistence | ovrHmdCap_DynamicPrediction);
    2.12  
    2.13 @@ -229,8 +232,6 @@
    2.14  {
    2.15  	if(!hmd) return 0;
    2.16  
    2.17 -	glDisable(GL_DEPTH_TEST);
    2.18 -
    2.19  	ovrHmd_EndFrame(hmd, pose, &eye_tex[0].Texture);
    2.20  	new_frame = 1;
    2.21  
    2.22 @@ -242,15 +243,12 @@
    2.23  	ovrSizei texsz;
    2.24  	ovrRecti rect;
    2.25  
    2.26 -	vmin = 1.0 - vmax;
    2.27 -	vmax = 1.0 - vmin;
    2.28 -
    2.29  	glBindTexture(GL_TEXTURE_2D, tex);
    2.30  	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &texsz.w);
    2.31  	glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &texsz.h);
    2.32  
    2.33  	rect.Pos.x = (int)(umin * texsz.w);
    2.34 -	rect.Pos.y = (int)(vmin * texsz.h);
    2.35 +	rect.Pos.y = (int)((vmin + 1.0 - vmax) * texsz.h);
    2.36  	rect.Size.w = (int)((umax - umin) * texsz.w);
    2.37  	rect.Size.h = (int)((vmax - vmin) * texsz.h);
    2.38