oculus2

changeset 8:4d6733229e01

porting to 0.4.3 (finally on linux)
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 25 Oct 2014 20:07:24 +0300
parents cd9f1560b909
children 9c36ae39ad95
files Makefile src/main.c
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/Makefile	Thu Sep 04 09:01:01 2014 +0300
     1.2 +++ b/Makefile	Sat Oct 25 20:07:24 2014 +0300
     1.3 @@ -3,7 +3,7 @@
     1.4  bin = oculus2
     1.5  
     1.6  CFLAGS = -pedantic -Wall -g `pkg-config --cflags sdl2`
     1.7 -LDFLAGS = $(libgl) `pkg-config --libs sdl2`
     1.8 +LDFLAGS = $(libgl) `pkg-config --libs sdl2` -lovr
     1.9  
    1.10  ifeq ($(shell uname -s), Darwin)
    1.11  	libgl = -framework OpenGL -lGLEW
     2.1 --- a/src/main.c	Thu Sep 04 09:01:01 2014 +0300
     2.2 +++ b/src/main.c	Sat Oct 25 20:07:24 2014 +0300
     2.3 @@ -257,10 +257,13 @@
     2.4  		 * we need to construct a view matrix by combining all the information provided by the oculus
     2.5  		 * SDK, about the position and orientation of the user's head in the world.
     2.6  		 */
     2.7 -		pose[eye] = ovrHmd_GetEyePose(hmd, eye);
     2.8 +		/* TODO: use ovrHmd_GetEyePoses out of the loop instead */
     2.9 +		pose[eye] = ovrHmd_GetHmdPosePerEye(hmd, eye);
    2.10  		glMatrixMode(GL_MODELVIEW);
    2.11  		glLoadIdentity();
    2.12 -		glTranslatef(eye_rdesc[eye].ViewAdjust.x, eye_rdesc[eye].ViewAdjust.y, eye_rdesc[eye].ViewAdjust.z);
    2.13 +		glTranslatef(eye_rdesc[eye].HmdToEyeViewOffset.x,
    2.14 +				eye_rdesc[eye].HmdToEyeViewOffset.y,
    2.15 +				eye_rdesc[eye].HmdToEyeViewOffset.z);
    2.16  		/* retrieve the orientation quaternion and convert it to a rotation matrix */
    2.17  		quat_to_matrix(&pose[eye].Orientation.x, rot_mat);
    2.18  		glMultMatrixf(rot_mat);
    2.19 @@ -540,4 +543,4 @@
    2.20  	glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 8, 8, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
    2.21  
    2.22  	return tex;
    2.23 -}
    2.24 \ No newline at end of file
    2.25 +}